arcanist-go icon indicating copy to clipboard operation
arcanist-go copied to clipboard

error occurs in testing govet

Open wangkirin opened this issue 9 years ago • 6 comments

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

wangkirin avatar May 05 '16 01:05 wangkirin

This happens because the error messages raised by the ArcanistGoVetLinter must have a name. There's a PR which solves this: https://github.com/kalbasit/arcanist-go/pull/1

For now, what you can do is to clone the repository above (since the PR hasn't been merged) and configure it in your project's .arcconfig file, or manually modify your local src/lint/linter/ArcanistGoVetLinter.php file with the same change on the PR:

$message->setName($this->getLinterName());

I had the same problem and the procedure above solved for me.

rodrigorigotti avatar May 09 '16 12:05 rodrigorigotti

@rodrigorigotti thank you very much , I wil have a try

wangkirin avatar May 10 '16 02:05 wangkirin

@rodrigorigotti I have tried your solution, It works, but there are another problem appears. When I use golint or govet to check the code, there are more than 1 line output, but in the final lint result there only one line. I tried to print the lenght of messages array,like

echo count($messages);

It turns out its also more than 1 ,and the content of array is also correct. So I don't know where is the problem.

@kalbasit Could you give some advice ?

wangkirin avatar May 12 '16 03:05 wangkirin

@wangkirin I don't use Arc anymore, unfortunately. Please let me know if you are interested in fixing the issues and taking over.

kalbasit avatar May 23 '17 03:05 kalbasit

Curious, what are you using instead?

nclinger avatar Jan 18 '18 22:01 nclinger

@nclinger Jira/Github.

kalbasit avatar Jan 19 '18 23:01 kalbasit