Skip to content
This repository has been archived by the owner on Apr 10, 2019. It is now read-only.

output file names are not relative to the current directory #53

Closed
alcortesm opened this issue Oct 9, 2015 · 2 comments
Closed

output file names are not relative to the current directory #53

alcortesm opened this issue Oct 9, 2015 · 2 comments

Comments

@alcortesm
Copy link

When I run gometalinter inside a project directory, the file names in its output are relative to my $GOPATH/src/ instead of to the current directory:

; echo $GOPATH
/home/alcortes/room/workspaces/go
; pwd
/home/alcortes/room/workspaces/go/src/alcortes/summerfield/ch4/ex4.4.1
; ls
guess_separator.go  guess_separator_internal_test.go  README.md  SCRIPTS  test_00_tabs.txt
; gometalinter 
alcortes/summerfield/ch4/ex4.4.1/guess_separator.go:33:13:warning: error return value not checked (file.Close()) (errcheck)
alcortes/summerfield/ch4/ex4.4.1/guess_separator_internal_test.go:22:18:warning: error return value not checked (buf.WriteString(lines[i] + "\n")) (errcheck)
alcortes/summerfield/ch4/ex4.4.1/guess_separator_internal_test.go:143:10:warning: error return value not checked (m.Seek(0, 0)) (errcheck)

Shouldn't it be something like this instead?

; gometalinter 
guess_separator.go:33:13:warning: error return value not checked (file.Close()) (errcheck)
guess_separator_internal_test.go:22:18:warning: error return value not checked (buf.WriteString(lines[i] + "\n")) (errcheck)
guess_separator_internal_test.go:143:10:warning: error return value not checked (m.Seek(0, 0)) (errcheck)
@pdf
Copy link
Contributor

pdf commented Oct 9, 2015

I think it's just errcheck output that's borked, for example, run gometalinter on a sub-package, it prepends the path it was called to with the package name output from errcheck, but other linters do the right thing:

echo $GOPATH
/storage/workspace/golang
echo $PWD
/storage/workspace/golang/src/my/project
find .
.
./main.go
./subpackage/file.go
gometalinter subpackage
subpackage/file.go:5:1:warning: comment on exported method Subpackage.Function should be of the form "Function ..." (golint)
subpackage/my/project/subpackage/file.go:6:10:warning: error return value not checked (some.Func()) (errcheck)

@alcortesm
Copy link
Author

You are right, I have been running some tests and the problem seems to happen only with errcheck.

Thank you very much!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants