Git Product home page Git Product logo

arcanist-go's People

Contributors

derekargueta avatar kalbasit avatar ottob avatar rayzyar avatar willyham avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

arcanist-go's Issues

Issue with `go vet` false positives

It appears there's a settle difference between go vet and go tool vet - go tool vet can resolve variables that may have been declared in a different file, whereas go vet won't. go vet appears to have the intention of being executed on a package level, not a file level.

Here's a simple example - I have a variable defined in a.go that I use in b.go. Running go vet on b.go results in an "undefined" error, but running go vet on the package is perfectly fine:

➜  demo cat a.go
package main

const foobar string = "hi"
➜  demo cat b.go
package main

import "fmt"

func doSomething() {
  fmt.Println(foobar)
}
➜  demo go vet b.go
# command-line-arguments [command-line-arguments.test]
./b.go:6:15: undefined: foobar
➜  demo go vet .
➜  demo

I don't have a great workaround for Go 1.12 yet (maybe lint the package but try to avoid re-linting the package by keeping track of what files have been checked? And only show vet errors for the changed files?). Perhaps in the meantime we can have a patch that if Go is < 1.12, continue to use go tool vet.

Thoughts @kalbasit ?

Related links:
golang/go#23916
dense-analysis/ale#1358

No open source license

Hi there,

There is no open source license on this repo. Can I use this code as is? Alternatively, I would also be willing to take over the repository if necessary.

Cheers,

Nate

error occurs in testing govet

I try to use arcanist-go as the additional linter in my project , and to test it , I write a line

fmt.Println("helloworld %v", test)

then I run arc lint to check it , but it returns the following message:

Exception
Linter "ArcanistGoVetLinter" generated a lint message that is invalid because it does not have a name. Lint messages must have a name.
(Run with `--trace` for a full exception trace.)

then I add --trace, the output is

LOAD  Loaded "phutil" from "/home/wang/workspace/pha/phautils/libphutil/src".
 LOAD  Loaded "arcanist" from "/home/wang/workspace/pha/phautils/arcanist/src".
Config: Reading user configuration file "/home/wang/.arcrc"...
Config: Did not find system configuration at "/etc/arcconfig".
Working Copy: Reading .arcconfig from "/home/wang/phalinttest/test/.arcconfig".
Working Copy: Path "/home/wang/phalinttest/test" is part of `git` working copy "/home/wang/phalinttest/test".
Working Copy: Project root is at "/home/wang/phalinttest/test".
Config: Did not find local configuration at "/home/wang/phalinttest/test/.git/arc/config".
Loading phutil library from '/home/wang/phalinttest/test/arcanist-go'...
Examining paths for linter 'chmod'.
Found 1 matching paths for linter 'chmod'.
Examining paths for linter 'filename'.
Found 1 matching paths for linter 'filename'.
Examining paths for linter 'gofmt'.
Found 1 matching paths for linter 'gofmt'.
Examining paths for linter 'golint'.
Found 1 matching paths for linter 'golint'.
Examining paths for linter 'govet'.
Found 1 matching paths for linter 'govet'.
Examining paths for linter 'json'.
Found 0 matching paths for linter 'json'.
Examining paths for linter 'merge-conflict'.
Found 1 matching paths for linter 'merge-conflict'.
Examining paths for linter 'spelling'.
Found 1 matching paths for linter 'spelling'.
Examining paths for linter 'text'.
Found 0 matching paths for linter 'text'.
>>> [0] <exec> $ which 'go'
<<< [0] <exec> 2,357 us
>>> [1] <exec> $ go tool vet
<<< [1] <exec> 10,366 us
>>> [2] <exec> $ which 'go'
<<< [2] <exec> 1,811 us
>>> [3] <exec> $ which 'golint'
<<< [3] <exec> 1,706 us
>>> [4] <lint> Merge Conflicts <paths = 1>
<<< [4] <lint> 267 us
>>> [5] <lint> Spellchecker <paths = 1>
<<< [5] <lint> 9,972 us
>>> [6] <lint> Go vet <paths = 1>
>>> [7] <exec> $ which 'go'
<<< [7] <exec> 2,050 us
>>> [8] <exec> $ go tool vet
<<< [8] <exec> 9,104 us
>>> [9] <exec> $ which 'go'
<<< [9] <exec> 1,847 us
>>> [10] <exec> $ which 'go'
<<< [10] <exec> 1,866 us
>>> [11] <exec> $ go tool vet
<<< [11] <exec> 9,835 us
>>> [12] <exec> $ 'go' 'tool' 'vet' '/home/wang/phalinttest/test/golinttest.go'
<<< [6] <lint> 26,825 us
>>> [13] <lint> Filename <paths = 1>
<<< [13] <lint> 94 us
>>> [14] <lint> Golint <paths = 1>
>>> [15] <exec> $ which 'golint'
<<< [15] <exec> 1,903 us
>>> [16] <exec> $ 'golint'  '/home/wang/phalinttest/test/golinttest.go'
<<< [14] <lint> 3,043 us
>>> [17] <lint> Chmod <paths = 1>
<<< [17] <lint> 89 us
>>> [18] <lint> Go fmt <paths = 1>
>>> [19] <exec> $ which 'gofmt'
<<< [19] <exec> 1,817 us
>>> [20] <exec> $ gofmt
<<< [20] <exec> 3,001 us
<<< [18] <lint> 5,244 us
>>> [21] <lint> Merge Conflicts <paths = 1>
<<< [21] <lint> 65 us
>>> [22] <lint> Spellchecker <paths = 1>
<<< [22] <lint> 59 us
>>> [23] <lint> Go vet <paths = 1>
<<< [12] <exec> 11,283 us
<<< [23] <lint> 1,785 us
>>> [24] <lint> Filename <paths = 1>
<<< [24] <lint> 70 us
>>> [25] <lint> Golint <paths = 1>
<<< [16] <exec> 8,822 us
<<< [25] <lint> 313 us
>>> [26] <lint> Chmod <paths = 1>
<<< [26] <lint> 64 us
>>> [27] <lint> Go fmt <paths = 1>
<<< [27] <lint> 63 us

[2016-05-05 01:45:08] EXCEPTION: (Exception) Linter "ArcanistGoVetLinter" generated a lint message that is invalid because it does not have a name. Lint messages must have a name. at [<arcanist>/src/lint/engine/ArcanistLintEngine.php:609]
arcanist(), arcanist-extensions(head=master, ref.master=9ac65eb0f7ec), phutil()
  #0 ArcanistLintEngine::validateLintMessage(ArcanistGoVetLinter, ArcanistLintMessage) called at [<arcanist>/src/lint/engine/ArcanistLintEngine.php:220]
  #1 ArcanistLintEngine::run() called at [<arcanist>/src/workflow/ArcanistLintWorkflow.php:334]
  #2 ArcanistLintWorkflow::run() called at [<arcanist>/scripts/arcanist.php:392]

could anyone tell me how to slove this? thanks

GoVet documentation is out of date

throw new ArcanistMissingLinterException(
sprintf(
"%s\n%s",
pht(
'Unable to locate "go vet" to run linter %s. You may need '.
'to install the binary, or adjust your linter configuration.',
get_class($this)),
pht(
'TO INSTALL: %s',
$this->getInstallInstructions())));
}
}
return $binary;
}
public function getInstallInstructions() {
return pht('Install Go vet using `go get golang.org/x/tools/cmd/vet`.');
}

In #7, the GoVet linter was changed to use go vet and it does not require additional software to be installed.

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.