@@ -18,13 +18,11 @@ import (
1818 "bufio"
1919 "bytes"
2020 "context"
21- _ "embed"
2221 "fmt"
2322 "io"
2423 "io/fs"
2524 "net/netip"
2625 "os"
27- "slices"
2826 "strconv"
2927 "strings"
3028 "text/template"
@@ -141,7 +139,7 @@ func (rc *ResolvConf) SetHeader(c string) {
141139
142140// NameServers returns addresses used in nameserver directives.
143141func (rc * ResolvConf ) NameServers () []netip.Addr {
144- return slices . Clone ( rc .nameServers )
142+ return append ([]netip. Addr ( nil ), rc .nameServers ... )
145143}
146144
147145// OverrideNameServers replaces the current set of nameservers.
@@ -152,7 +150,7 @@ func (rc *ResolvConf) OverrideNameServers(nameServers []netip.Addr) {
152150
153151// Search returns the current DNS search domains.
154152func (rc * ResolvConf ) Search () []string {
155- return slices . Clone ( rc .search )
153+ return append ([] string ( nil ), rc .search ... )
156154}
157155
158156// OverrideSearch replaces the current DNS search domains.
@@ -169,7 +167,7 @@ func (rc *ResolvConf) OverrideSearch(search []string) {
169167
170168// Options returns the current options.
171169func (rc * ResolvConf ) Options () []string {
172- return slices . Clone ( rc .options )
170+ return append ([] string ( nil ), rc .options ... )
173171}
174172
175173// Option finds the last option named search, and returns (value, true) if
@@ -192,7 +190,7 @@ func (rc *ResolvConf) Option(search string) (string, bool) {
192190
193191// OverrideOptions replaces the current DNS options.
194192func (rc * ResolvConf ) OverrideOptions (options []string ) {
195- rc .options = slices . Clone ( options )
193+ rc .options = append ([] string ( nil ), options ... )
196194 rc .md .NDotsFrom = ""
197195 if _ , exists := rc .Option ("ndots" ); exists {
198196 rc .md .NDotsFrom = "override"
@@ -314,7 +312,7 @@ func (rc *ResolvConf) TransformForIntNS(
314312 }
315313
316314 rc .md .Transform = "internal resolver"
317- return slices . Clone ( rc .md .ExtNameServers ), nil
315+ return append ([] ExtDNSEntry ( nil ), rc .md .ExtNameServers ... ), nil
318316}
319317
320318// Generate returns content suitable for writing to a resolv.conf file. If comments
0 commit comments