Skip to content

Commit 220f028

Browse files
committed
cmd/scriggo: add 'debug/buildinfo' and 'net/netip' packages to stdlib
For #939
1 parent 0765896 commit 220f028

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

cmd/scriggo/main.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -645,8 +645,17 @@ func execGoCommand(dir string, args ...string) (out io.Reader, err error) {
645645
// stdLibPaths returns a copy of stdlibPaths with the packages for the runtime
646646
// Go version.
647647
func stdLibPaths() []string {
648-
paths := make([]string, len(stdlibPaths))
649-
copy(paths, stdlibPaths)
648+
version := goBaseVersion(runtime.Version())
649+
paths := make([]string, 0, len(stdlibPaths))
650+
for _, path := range stdlibPaths {
651+
switch path {
652+
case "debug/buildinfo", "net/netip":
653+
if version != "go1.18" {
654+
continue
655+
}
656+
}
657+
paths = append(paths, path)
658+
}
650659
return paths
651660
}
652661

@@ -686,6 +695,7 @@ var stdlibPaths = []string{
686695
"crypto/tls",
687696
"crypto/x509",
688697
"crypto/x509/pkix",
698+
"debug/buildinfo", // Go version 1.18
689699
"debug/dwarf",
690700
"debug/elf",
691701
"debug/gosym",
@@ -758,6 +768,7 @@ var stdlibPaths = []string{
758768
"net/http/httputil",
759769
"net/http/pprof",
760770
"net/mail",
771+
"net/netip", // Go version 1.18
761772
"net/rpc",
762773
"net/rpc/jsonrpc",
763774
"net/smtp",

0 commit comments

Comments
 (0)