Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install package #1037

Closed
2 of 3 tasks
turkk33 opened this issue Apr 22, 2020 · 4 comments
Closed
2 of 3 tasks

Unable to install package #1037

turkk33 opened this issue Apr 22, 2020 · 4 comments
Labels
area: install Issue relates to installation or downloading process feedback required Requires additional feedback

Comments

@turkk33
Copy link

turkk33 commented Apr 22, 2020

Thank you for creating the issue!

  • Yes, I'm using a binary release within 2 latest major releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).

Can't install package:

-> % go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
# github.com/golangci/golangci-lint/pkg/golinters
../../github.com/golangci/golangci-lint/pkg/golinters/golint.go:21:14: l.LintPkg undefined (type *"github.com/golangci/lint-1".Linter has no field or method LintPkg)
../../github.com/golangci/golangci-lint/pkg/golinters/gomnd.go:13:6: cannot use magic_numbers.Analyzer (type *"github.com/tommy-muehle/go-mnd/vendor/golang.org/x/tools/go/analysis".Analyzer) as type *"golang.org/x/tools/go/analysis".Analyzer in array or slice literal
@ernado ernado added the area: install Issue relates to installation or downloading process label Apr 22, 2020
@ernado
Copy link
Member

ernado commented Apr 22, 2020

Please try using go modules:

$ GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.24.0

@ernado ernado added the feedback required Requires additional feedback label Apr 22, 2020
prachirp added a commit to prachirp/kpt-functions-sdk that referenced this issue Apr 23, 2020
- Follow the suggestion for golangci-lint (golangci/golangci-lint#1037)
@turkk33 turkk33 closed this as completed Apr 23, 2020
@evzpav
Copy link

evzpav commented Apr 30, 2020

Updated to version 1.25.1. For a project it did worked. However for another project I got this error:

9 [lint 1/1] RUN golangci-lint run -v -c ./.golangci.yml
#9 0.840 level=info msg="[config_reader] Used config file .golangci.yml"
#9 0.857 level=info msg="[lintersdb] Active 17 linters: [deadcode errcheck goconst gocyclo golint gosec gosimple govet ineffassign interfacer maligned staticcheck structcheck typecheck unconvert unused varcheck]"
#9 0.857 level=info msg="[lintersdb] Active 17 linters: [deadcode errcheck goconst gocyclo golint gosec gosimple govet ineffassign interfacer maligned staticcheck structcheck typecheck unconvert unused varcheck]"
#9 1.362 level=info msg="[loader] Go packages loading at mode 575 (files|compiled_files|deps|name|types_sizes|exports_file|imports) took 504.748582ms"
#9 1.362 level=error msg="Running error: context loading failed: no go files to analyze"
#9 1.362 level=info msg="Memory: 7 samples, avg is 68.7MB, max is 68.7MB"
#9 1.362 level=info msg="Execution took 515.203041ms"
#9 ERROR: executor failed running [/bin/sh -c golangci-lint run -v -c ./.golangci.yml]: exit code: 5

Could you please advise @ernado ? I tried commenting linters but did not solve it.

@ernado
Copy link
Member

ernado commented Apr 30, 2020

Please provide a way to reproduce this issue @evzpav

Kuniwak added a commit to DeNA/devfarm that referenced this issue May 11, 2020
achilleasa added a commit to achilleasa/juju that referenced this issue May 11, 2020
The linter dependencies use strings.ReplaceAll which was introduced in
go 1.12 and some other stuff that needs a more recent go version. Note
that this only affects CI builds as release builds use a pre-installed
(via apt or snap depending on series) go binary and don't run CI tests.

In addition, since we now have go 1.14, this commit also installs
golangci-lint with go modules enabled to work around
golangci/golangci-lint#1037.
@detailyang
Copy link

It works via GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint.

BTW: do not use -u flag to upgrade dep because of https://github.com/tetafro/godot v0.4.2 break changes from v0.3.7

FreakyTurtle added a commit to FreakyTurtle/theia-apps that referenced this issue May 26, 2020
Fix for the build failing at the go linter "go get" on line 110.  Inspiration for the fix came from this thread golangci/golangci-lint#1037 in the golangci repo itself where others were having a similar issue.
FreakyTurtle added a commit to FreakyTurtle/theia-apps that referenced this issue May 26, 2020
Fix for the build failing at the go linter "go get" on line 110.  Inspiration for the fix came from this thread golangci/golangci-lint#1037 in the golangci repo itself where others were having a similar issue.

Signed-off-by: FreakyTurtle <jagues@gmail.com>
vince-fugnitto pushed a commit to theia-ide/theia-apps that referenced this issue May 26, 2020
Fix for the build failing at the go linter "go get" on line 110.  Inspiration for the fix came from this thread golangci/golangci-lint#1037 in the golangci repo itself where others were having a similar issue.

Signed-off-by: FreakyTurtle <jagues@gmail.com>
johnboyes added a commit to agilepathway/label-checker that referenced this issue Jul 5, 2020
Prior to this commit, vscode was saying "Analysis tools missing" and
prompting to install it.
Fix was to install golangci-lint via go get, as per:
golangci/golangci-lint#1037 (comment)
johnboyes added a commit to agilepathway/label-checker that referenced this issue Jul 5, 2020
Prior to this commit, vscode was saying "Analysis tools missing" and
prompting to install it.
Fix was to install golangci-lint via go get, as per:
golangci/golangci-lint#1037 (comment)
johnboyes added a commit to agilepathway/label-checker that referenced this issue Jul 5, 2020
Prior to this commit, vscode was saying "Analysis tools missing" and
prompting to install it.
Fix was to install golangci-lint via go get, as per:
golangci/golangci-lint#1037 (comment)
johnboyes added a commit to agilepathway/label-checker that referenced this issue Jul 5, 2020
* Enable Codespaces - add default Go files

Codespaces[1] allows us to use a remote vscode environment embedded in
the browser in GitHub[1]

This commit adds the pre-built container configuration[2] for Go[3].
We can customise this configuration as we wish in future commits.

[1] https://github.com/features/codespaces/
[2] https://docs.github.com/en/github/developing-online-with-codespaces/configuring-codespaces-for-your-project#using-a-pre-built-container-configuration
[3] https://github.com/microsoft/vscode-dev-containers/tree/master/containers/go

* Suppress/fix devcontainer Dockerfile warnings

These were hadolint warnings, and there were three of them, all on
.devcontainer/Dockerfile#L17:

DL3003 Use WORKDIR to switch to a directory

DL3008 Pin versions in apt get install.
Instead of `apt-get install <package>`
use `apt-get install <package>=<version>`

DL3015 Avoid additional packages by specifying `--no-install-recommends`

Suppressed the warnings apart from the DL3015 one, which was easy to
fix.

Not fixing the other warnings (for now anyway) as this Dockerfile is
code that has been lifted and shifted from the
`.devcontainer/Dockerfile` in:
https://github.com/microsoft/vscode-dev-containers/tree/master/containers/go

* Update module settings to "on" as we use modules

See:
https://dev.to/maelvls/why-is-go111module-everywhere-and-everything-about-go-modules-24k

* Add shellcheck vscode extension to devcontainer

https://www.shellcheck.net/
https://marketplace.visualstudio.com/items?itemName=timonwong.shellcheck

* Use vscode go language server on devcontainer

https://github.com/golang/vscode-go/blob/master/docs/gopls.md

* Stop installing go dependencies on devcontainer

There is no need to install them as we are using go modules - see:
microsoft/vscode-go#2836

* Set vscode editor go tabsize to correct size of 8

See:
microsoft/vscode-go#2479 (comment)

* Use golangci-lint for vscode devcontainer linting

https://github.com/golangci/golangci-lint

* No longer install Guru on devcontainer

It does not support Go modules:
https://github.com/golang/vscode-go/blob/master/docs/tools.md#guru

* Remove unnecessary gorename from devcontainer

Not needed when using go modules and gopls language server:
https://github.com/golang/vscode-go/blob/master/docs/tools.md#gorename

* Remove unnecessary godoctor from devcontainer

It is not needed when using go modules and the gopls language server:
https://github.com/golang/vscode-go/blob/master/docs/tools.md#godoctor

* Remove unnecessary goimports from devcontainer

Imports are instead handled by the gopls language server:
golang/go#33587 (comment)

* Remove unnecessary golint from devcontainer

Not needed as we are using golangci-lint

* Remove unnecessary gotests from devcontainer

gotests autogenerates table tests boilerplate code.  We don't need this
for this project.

* Remove unnecessary goplay module from devcontainer

We don't need this functionality:
https://github.com/haya14busa/goplay/

* Remove unnecessary gometalinter from devcontainer

Not needed as we are using golangci-lint for linting.

* Remove unnecessary impl module from devcontainer

It does not have support for go modules:
golang/go#37537

* Remove unnecessary fillstruct from devcontainer

fillstruct fills a struct literal with default values[1]
This functionality is now available in the gopls language server[2]

[1] https://github.com/davidrjenni/reftools/tree/master/cmd/fillstruct
[2] golang/go#37576 (comment)

* Add comment to explain why gopkgs is still needed

It is still needed even with gopls:
microsoft/vscode-go#3050 (comment)

* Fix installation of golangci-lint on devcontainer

Prior to this commit, vscode was saying "Analysis tools missing" and
prompting to install it.
Fix was to install golangci-lint via go get, as per:
golangci/golangci-lint#1037 (comment)

* Remove unnecessary gogetdoc from devcontainer

Similar functionality is available in the gopls language server:
fatih/vim-go#2808 (comment)

* Remove unnecessary revive linter from devcontainer

We are using golangci-lint for linting, so no need for revive.

* Remove unnecessary go-tools from devcontainer

go-tools primarily contains staticcheck, which we don't need as we are
using golangci-lint for linting.

* Output go version after building devcontainer

Doing this just to provide assurance that the container has started
successfully, after building.

* Move settings which are not container-specific

The guideline for`devcontainer.json` settings is that they should only
contain settings which _must_ be be changed in a container (e.g.
absolute paths)[1].

Moved the other settings to `.vscode/settings.json` so that they are
more visible, and easier to use when working locally (i.e. not in a
container).

[1] microsoft/vscode-remote-release#874 (comment)

* Up tests timeout as tests are slower on container

The tests seem to run much slower (c. 100 seconds compared to c. 50
seconds) when running on a remote container, compared to locally.
Will investigate to see if this is the same when running on Codespaces.

If the tests are taking 100 seconds we may need to create an issue to
speed them up.

* Add recommended vscode go settings

As per the recommendations at:
https://github.com/golang/tools/blob/master/gopls/doc/vscode.md

* Set dark colour theme for vscode in devcontainer

* Set devcontainer vscode to autosave after 500ms

Adding these settings to the devcontainer settings file rather than the
vscode settings file, as we want them to apply at the machine level.

https://code.visualstudio.com/docs/editor/codebasics#_save-auto-save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: install Issue relates to installation or downloading process feedback required Requires additional feedback
Projects
None yet
Development

No branches or pull requests

4 participants