0

I run locally on my project the following command

gometalinter --config=gometalinter.json ./...

at the beginning I got some errors and I was fixed them all!

now I run the same command exaclty in Travis script and I got vendor errros like

vendor/github.com/spf13/viper/flags.go:3:8:warning: error return value not checked (could not import github.com/spf13/pflag (go/build: importGo github.com/spf13/pflag: exit status 1) (errcheck)
vendor/github.com/spf13/viper/viper.go:42:7:warning: error return value not checked (could not import github.com/pelletier/go-toml (go/build: importGo github.com/pelletier/go-toml: exit status 1) (errcheck)

This is the gometalinter.json for the config

{
  "vendor": true,
  "Deadline": "2m",
  "Sort": [
    "linter",
    "severity"
  ],
  "DisableAll": true,
  "Enable": [
    "gotypex",
    "vetshadow",
    "errcheck",
    "gocyclo",
    "vet",
    "golint",
    "vetshadow",
    "ineffassign",


  ],
  "Cyclo": 10,
  "LineLength": 120
}

I dont understand why locally I dont get this error (i've the vendor repo) and why it ask for vendor error ? what could be the reason ?

07_05_GuyT
  • 2,787
  • 14
  • 43
  • 88

2 Answers2

0

gometalinter runs binaries in your path to do its check. I have had problems where my CI would have one set of binaries versions while my local development environment would have different versions.

Try updating all the required binaries on your local machine.

poy
  • 10,063
  • 9
  • 49
  • 74
  • I run `gometalinter --install --force` and still I dont see errors locally just on travis. any idea? I use `v2.0.11` of gometalinter – 07_05_GuyT Nov 18 '18 at 18:43
0

Try --vendor flag and check versions of gometalinter and all used linters.

Extract from gometalinter documentation:

How do I make gometalinter work with Go 1.5 vendoring?

gometalinter has a --vendor flag that just sets GO15VENDOREXPERIMENT=1, however the underlying tools must support it. Ensure that all of the linters are up to date and built with Go 1.5 (gometalinter --install --force) then run gometalinter --vendor .. That should be it.

Dmitry Harnitski
  • 5,838
  • 1
  • 28
  • 43
  • Thanks I've tried it `run gometalinter --install --force` and still when I run locally I dont get any error, just when I run it on Travis. what is strange is that I run it with --vendor in travis and also in the config json and still I got the warnings on vendor packages..., any idea, hint what it could be ? – 07_05_GuyT Nov 18 '18 at 18:41
  • check version of `errcheck` in local env and travis – Dmitry Harnitski Nov 18 '18 at 18:48