Giter Club home page Giter Club logo

Comments (11)

amckague avatar amckague commented on July 20, 2024 1

Does bazel clean --expunge change the error for you?

The attached WORKSPACE file below works for me. metalinter runs and reports various linting issues (including linting issues in /vendor). I suggest adding config = "//:.gometalinter.json", to the gometalinter configuration in BUILD.bazel and use it to configure linting to ignore the vendor folder altogether.

WORKSPACE.txt

from bazel-tools.

ash2k avatar ash2k commented on July 20, 2024

Hey, can you share the exact full WORKSPACE and BUILD files and also the exact full error message that bazel is giving you? I cannot help with just the information you have provided, sorry.

from bazel-tools.

kkumar1234 avatar kkumar1234 commented on July 20, 2024

Hi,

Attached are WORKSPACE and BUILD file contents:
build
workspace

After removing vendor directory from https://github.com/stretchr/testify, gometalinter target is unable to resolve symbols. Few sample errors:

bazel run //:gometalinter
INFO: Analysed target //:gometalinter (0 packages loaded).
INFO: Found 1 target...
Target //:gometalinter up-to-date:
bazel-bin/gometalinter.bash
INFO: Elapsed time: 0.294s, Critical Path: 0.00s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
assert/assertions.go:19:2:warning: could not import github.com/davecgh/go-spew/spew (cannot find package "github.com/davecgh/go-spew/spew" in any of: (unconvert)
assert/assertions.go:20:2:warning: could not import github.com/pmezard/go-difflib/difflib (cannot find package "github.com/pmezard/go-difflib/difflib" in any of: (unconvert)
mock/mock.go:13:2:warning: could not import github.com/davecgh/go-spew/spew (cannot find package "github.com/davecgh/go-spew/spew" in any of: (unconvert)
mock/mock.go:14:2:warning: could not import github.com/pmezard/go-difflib/difflib (cannot find package "github.com/pmezard/go-difflib/difflib" in any of: (unconvert)
mock/mock.go:15:2:warning: could not import github.com/stretchr/objx (cannot find package "github.com/stretchr/objx" in any of: (unconvert)
assert/assertions.go:19:2:warning: could not import github.com/davecgh/go-spew/spew (cannot find package "github.com/davecgh/go-spew/spew" in any of: (maligned)
assert/assertions.go:20:2:warning: could not import github.com/pmezard/go-difflib/difflib (cannot find package "github.com/pmezard/go-difflib/difflib" in any of: (maligned)
mock/mock.go:13:2:warning: could not import github.com/davecgh/go-spew/spew (cannot find package "github.com/davecgh/go-spew/spew" in any of: (maligned)
mock/mock.go:14:2:warning: could not import github.com/pmezard/go-difflib/difflib (cannot find package "github.com/pmezard/go-difflib/difflib" in any of: (maligned)

With bazel, all packages can be provided as dependency, so my requirement is to allow all external dependencies via target and not via vendor folder.

Thanks
Kailash

from bazel-tools.

amckague avatar amckague commented on July 20, 2024

Double checking: which version of bazel are you running?

from bazel-tools.

kkumar1234 avatar kkumar1234 commented on July 20, 2024

Hi,

I am using 0.16.0 version of bazel. Please find below output of version command.

bazel version

Build label: 0.16.0
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Jul 31 17:01:24 2018 (1533056484)

Thanks
Kailash

from bazel-tools.

amckague avatar amckague commented on July 20, 2024

Can you paste the contents of those files rather than an image? (so I can attempt to reproduce the issue)

from bazel-tools.

kkumar1234 avatar kkumar1234 commented on July 20, 2024

BUILD.txt
WORKSPACE.txt
Hi,

I have uploaded the file in text format. Steps to reproduce:

go get -u github.com/stretchr/testify
cd $GOPATH/src/github.com/stretchr/testify
copy BUILD and WORKSPACE to root of testify repo.
execute gometalinter rule using bazel

Thanks
Kailash

from bazel-tools.

amckague avatar amckague commented on July 20, 2024

Is there a typo in the attached files?

bazel run //:gometalinter
ERROR: error loading package '': Encountered error while reading extension file 'go/def.bzl': no such package '@io_bazel_rules_go//go': Error downloading [https://github.com/bazelbuild/rules_go/releases/download/0.15.1/rules_go-0.15.1.tar.gz] to /home/amckague/.cache/bazel/_bazel_amckague/d1309ac1e2719cdf777c0d6e936fc92b/external/io_bazel_rules_go/rules_go-0.15.1.tar.gz: Checksum was 5f3b0304cdf0c505ec9e5b3c4fc4a87b5ca21b13d8ecc780c97df3d1809b9ce6 but wanted 5756a4ad75b3703eb68249d50e23f5d64eaf1593e886b9aa931aa6e938c4e301
ERROR: error loading package '': Encountered error while reading extension file 'go/def.bzl': no such package '@io_bazel_rules_go//go': Error downloading [https://github.com/bazelbuild/rules_go/releases/download/0.15.1/rules_go-0.15.1.tar.gz] to /home/amckague/.cache/bazel/_bazel_amckague/d1309ac1e2719cdf777c0d6e936fc92b/external/io_bazel_rules_go/rules_go-0.15.1.tar.gz: Checksum was 5f3b0304cdf0c505ec9e5b3c4fc4a87b5ca21b13d8ecc780c97df3d1809b9ce6 but wanted 5756a4ad75b3703eb68249d50e23f5d64eaf1593e886b9aa931aa6e938c4e301
INFO: Elapsed time: 5.107s
INFO: 0 processes.

Removing references to the this lib and it's rules doesn't help the above error.

from bazel-tools.

ash2k avatar ash2k commented on July 20, 2024

Another issue that I noticed is that go_rules_dependencies() and go_register_toolchains() are invoked twice. The second pair of calls can be removed.

from bazel-tools.

kkumar1234 avatar kkumar1234 commented on July 20, 2024

Hi,

The same WORKSPACE file is working fine for me.
In your case, line 4 in WORKSPACE file having sha256 can be replaced by 5f3b0304cdf0c505ec9e5b3c4fc4a87b5ca21b13d8ecc780c97df3d1809b9ce6.

This will ensure checksum validation completes.
I agree second pair is redundant and can be removed.

Also, please try bazel run command keeping vendor directory and then without any vendor directory in the git repo.

Thanks
Kailash

from bazel-tools.

ash2k avatar ash2k commented on July 20, 2024

Also see https://github.com/atlassian/smith/blob/master/.gometalinter.json and https://github.com/atlassian/smith/blob/master/BUILD.bazel#L68-L79 for inspiration =)

from bazel-tools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.