diff options
| author | Shulhan <ms@kilabit.info> | 2023-05-27 00:08:20 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2023-05-27 00:08:20 +0700 |
| commit | eabefcf70b240fb23e874104ea4f289d68631978 (patch) | |
| tree | ea33aa3a5cd292dc83fc7a6b62b8f60c1807c625 | |
| parent | 06e6cbdd511cdd0b969d34c2e5a5e975566cbdc8 (diff) | |
| download | pakakeh.go-eabefcf70b240fb23e874104ea4f289d68631978.tar.xz | |
lib/net: add _test suffix to Example in test
This is to prevent non-exported functions, type, or variables being used
in example.
| -rw-r--r-- | lib/net/resolvconf_example_test.go | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/net/resolvconf_example_test.go b/lib/net/resolvconf_example_test.go index c33630ad..62d3ed88 100644 --- a/lib/net/resolvconf_example_test.go +++ b/lib/net/resolvconf_example_test.go @@ -2,28 +2,31 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package net +package net_test import ( "bytes" "fmt" "log" + + libnet "github.com/shuLhan/share/lib/net" ) func ExampleResolvConf_PopulateQuery() { var ( - resconf = &ResolvConf{ - Domain: "internal", - Search: []string{"my.internal"}, + resconf = &libnet.ResolvConf{ + Domain: `internal`, + Search: []string{`my.internal`}, NDots: 1, } queries []string ) - queries = resconf.PopulateQuery("vpn") + queries = resconf.PopulateQuery(`vpn`) fmt.Println(queries) - queries = resconf.PopulateQuery("a.machine") + queries = resconf.PopulateQuery(`a.machine`) fmt.Println(queries) + //Output: //[vpn vpn.my.internal] //[a.machine] @@ -31,7 +34,7 @@ func ExampleResolvConf_PopulateQuery() { func ExampleResolvConf_WriteTo() { var ( - rc = &ResolvConf{ + rc = &libnet.ResolvConf{ Domain: `internal`, Search: []string{`a.internal`, `b.internal`}, NameServers: []string{`127.0.0.1`, `192.168.1.1`}, |
