Skip to content

Commit

Permalink
cmd/scriggo: add 'debug/buildinfo' and 'net/netip' packages to stdlib
Browse files Browse the repository at this point in the history
 For #939
  • Loading branch information
gazerro committed Jul 4, 2022
1 parent 0765896 commit 220f028
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions cmd/scriggo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -645,8 +645,17 @@ func execGoCommand(dir string, args ...string) (out io.Reader, err error) {
// stdLibPaths returns a copy of stdlibPaths with the packages for the runtime
// Go version.
func stdLibPaths() []string {
paths := make([]string, len(stdlibPaths))
copy(paths, stdlibPaths)
version := goBaseVersion(runtime.Version())
paths := make([]string, 0, len(stdlibPaths))
for _, path := range stdlibPaths {
switch path {
case "debug/buildinfo", "net/netip":
if version != "go1.18" {
continue
}
}
paths = append(paths, path)
}
return paths
}

Expand Down Expand Up @@ -686,6 +695,7 @@ var stdlibPaths = []string{
"crypto/tls",
"crypto/x509",
"crypto/x509/pkix",
"debug/buildinfo", // Go version 1.18
"debug/dwarf",
"debug/elf",
"debug/gosym",
Expand Down Expand Up @@ -758,6 +768,7 @@ var stdlibPaths = []string{
"net/http/httputil",
"net/http/pprof",
"net/mail",
"net/netip", // Go version 1.18
"net/rpc",
"net/rpc/jsonrpc",
"net/smtp",
Expand Down

0 comments on commit 220f028

Please sign in to comment.