go-licenses: golang.org/x/sys and other packages don't seem to work

I’m walking through the dependencies in my go.mod and I find that the golang.org/x/ repositories give me trouble:

% go-licenses csv golang.org/x/sys
Error: errors for ["golang.org/x/sys"]:
golang.org/x/sys: -: module golang.org/x/sys@latest found (v0.0.0-20200420163511-1957bb5e6d1f), but does not contain package golang.org/x/sys
Usage:
  licenses csv <package> [flags]

Flags:
      --git_remote stringArray   Remote Git repositories to try (default [origin,upstream])
  -h, --help                     help for csv

Global Flags:
      --alsologtostderr                  log to standard error as well as files
      --confidence_threshold float       Minimum confidence required in order to positively identify a license. (default 0.9)
      --log_backtrace_at traceLocation   when logging hits line file:N, emit a stack trace (default :0)
      --log_dir string                   If non-empty, write log files in this directory
      --logtostderr                      log to standard error instead of files
      --stderrthreshold severity         logs at or above this threshold go to stderr (default 2)
  -v, --v Level                          log level for V logs
      --vmodule moduleSpec               comma-separated list of pattern=N settings for file-filtered logging

F0423 16:43:51.988116     851 main.go:43] errors for ["golang.org/x/sys"]:
golang.org/x/sys: -: module golang.org/x/sys@latest found (v0.0.0-20200420163511-1957bb5e6d1f), but does not contain package golang.org/x/sys

Is there a trick to this? Advice?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 6
  • Comments: 15 (7 by maintainers)

Most upvoted comments

Sure: I am on macOS 10.16.0 Big Sur and I have tried with different values for the GO111MODULE env variable.

  • if installing via go install golang.org/x/sys@latest I get a combination of “no Go files in ~/go/src/golang.org/x/sys” and “module golang.org/x/sys@latest found (v0.1.0), but does not contain package golang.org/x/sys” according to whether or not I set GO111MODULE to explicit values.

  • if importing golang.org/x/sys in a module and running go mod tidy I get

../../go/pkg/mod/golang.org/x/sys@v0.0.0-20200918174421-af09f7315aff/unix/zsyscall_darwin_arm64.1_13.go:40:3: /go:linkname must refer to declared function or variable

The commands you ran do not relate to go licenses though.

Note golang.org/x/sys is not a go package, that’s why those commands failed. There are go packages with golang.org/x/sys as prefix.

Here is a repo showing this problem: https://github.com/dcormier/go-licenses (complete with the requested go.mod file)

Here is the result of running the command in that repo:

> go-licenses csv ./...
E1124 13:39:33.985051    5489 library.go:108] Failed to find license for github.com/dcormier/go-licenses: no file/directory matching regexp "^(?i)(LICEN(S|C)E|COPYING|README|NOTICE)(\\..+)?$" found for /Users/daniel/dev/go-licenses
E1124 13:39:35.655555    5489 csv.go:84] Error discovering URL for "/Users/daniel/go/pkg/mod/go.uber.org/atomic@v1.7.0/LICENSE.txt":
- cannot determine URL for "go.uber.org/atomic" package
E1124 13:39:35.660957    5489 csv.go:84] Error discovering URL for "/Users/daniel/go/pkg/mod/contrib.go.opencensus.io/exporter/aws@v0.0.0-20200617204711-c478e41e60e9/LICENSE":
- unsupported package host "contrib.go.opencensus.io" for "contrib.go.opencensus.io/exporter/aws"
E1124 13:39:35.698183    5489 csv.go:84] Error discovering URL for "/Users/daniel/go/pkg/mod/go.opencensus.io@v0.22.5/LICENSE":
- cannot determine URL for "go.opencensus.io" package
E1124 13:39:35.766210    5489 csv.go:84] Error discovering URL for "/Users/daniel/go/pkg/mod/go.uber.org/fx@v1.13.1/LICENSE":
- cannot determine URL for "go.uber.org/fx" package
E1124 13:39:35.770829    5489 csv.go:84] Error discovering URL for "/Users/daniel/go/pkg/mod/go.uber.org/multierr@v1.6.0/LICENSE.txt":
- cannot determine URL for "go.uber.org/multierr" package
E1124 13:39:35.778800    5489 csv.go:84] Error discovering URL for "/Users/daniel/go/pkg/mod/golang.org/x/text@v0.3.4/LICENSE":
- unsupported package host "golang.org" for "golang.org/x/text"
E1124 13:39:35.827558    5489 csv.go:84] Error discovering URL for "/Users/daniel/go/pkg/mod/go.uber.org/dig@v1.10.0/LICENSE":
- cannot determine URL for "go.uber.org/dig" package
E1124 13:39:35.834144    5489 csv.go:84] Error discovering URL for "/Users/daniel/go/pkg/mod/golang.org/x/net@v0.0.0-20201110031124-69a78807bb2b/LICENSE":
- unsupported package host "golang.org" for "golang.org/x/net/idna"
go.uber.org/atomic,Unknown,MIT
github.com/dcormier/go-licenses,Unknown,Unknown
contrib.go.opencensus.io/exporter/aws,Unknown,Apache-2.0
github.com/jmespath/go-jmespath,https://github.com/jmespath/go-jmespath/blob/master/LICENSE,Apache-2.0
go.opencensus.io,Unknown,Apache-2.0
github.com/golang/groupcache/lru,https://github.com/golang/groupcache/blob/master/lru/LICENSE,Apache-2.0
go.uber.org/fx,Unknown,MIT
go.uber.org/multierr,Unknown,MIT
golang.org/x/text,Unknown,BSD-3-Clause
github.com/aws/aws-sdk-go,https://github.com/aws/aws-sdk-go/blob/master/LICENSE.txt,Apache-2.0
github.com/aws/aws-sdk-go/internal/sync/singleflight,https://github.com/aws/aws-sdk-go/blob/master/internal/sync/singleflight/LICENSE,BSD-3-Clause
go.uber.org/dig,Unknown,MIT
golang.org/x/net/idna,Unknown,BSD-3-Clause
>