Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Add a question about requiring packages with no Go code to the FAQ #1272

Closed
ibrasho opened this issue Oct 14, 2017 · 4 comments
Closed

Add a question about requiring packages with no Go code to the FAQ #1272

ibrasho opened this issue Oct 14, 2017 · 4 comments

Comments

@ibrasho
Copy link
Collaborator

ibrasho commented Oct 14, 2017

We should add a question to the FAQ to clarify how to add cli tools like staticcheck (from honnef.co/go/tools) ... etc.

If someone attempts to add honnef.co/go/tools to their required packages they will get the following error:

master: Could not introduce honnef.co/go/tools@master, as its subpackage honnef.co/go/tools does not contain usable Go code (*build.NoGoError).. (Package is required by (root).)

since dep expect the required package to contain some Go code.

The solution is to require a package that contains the actual code (e.g. honnef.co/go/tools/cmd/staticcheck or honnef.co/go/tools/cmd/megacheck).

Note: we should clearly state that all tools should be added to required, as prune might remove packages that are not required.

See #1263.

@groob
Copy link
Contributor

groob commented Oct 14, 2017

Is there an issue for doing something equivalent to go get honnef.co/go/tools/... ?

@ibrasho
Copy link
Collaborator Author

ibrasho commented Oct 14, 2017

I think we have that for ignore rules at the moment. (right, @darkowlzz ?)

I'm not sure if that's possible for the required field too...

@darkowlzz
Copy link
Collaborator

AFAIK, required is combined with the imported packages and the whole projects are downloaded. So if you say honnef.co/go/tools/cmd/staticcheck, it would download the whole source of honnef.co/go/tools/, which comes with honnef.co/go/tools/cmd/megacheck and all other packages. And then you can build those tools individually, the usual way.

@ibrasho
Copy link
Collaborator Author

ibrasho commented Oct 15, 2017

I worried that might be changed when prune is absorbed into ensure. 😄

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants