Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

No build errors when code fails on import cycle #664

Closed
atombender opened this issue Nov 29, 2016 · 6 comments
Closed

No build errors when code fails on import cycle #664

atombender opened this issue Nov 29, 2016 · 6 comments

Comments

@atombender
Copy link

When I get an accidental import cycle, I get zero build errors in VSCode. But manually building, I of course get:

$ go build -v github.com/sanity-io/gradient/pkg/search/queryengine
can't load package: import cycle not allowed
[etc.]

This is frustrating because when this happens, it appears that compilation/linting has just stopped working.

(Funnily enough, Atom's go-plus package has the exact same issue.)

My Go settings:

	"go.buildOnSave": true,
	"go.lintOnSave": true,
	"go.vetOnSave": true,
	"go.lintTool": "gometalinter",
	"go.lintFlags": [
		"--disable-all",
		// Linters
		"--enable=deadcode",
		"--enable=vetshadow",
		"--enable=golint",
		//"--enable=errcheck",
		"--enable=ineffassign",
		"--enable=goconst",
		// Exclude stuff
		"--exclude=\\.pb\\.go",
		"--exclude=or be unexported",
		"--exclude=that.stutters",
		"--exclude=don't use underscores",
		"--exclude=\\.nolint\\.go",
		"--vendor",
		"--tests"
	],
	"go.useCodeSnippetsOnFunctionSuggest": false,
	"go.formatOnSave": true,
	"go.formatTool": "goreturns",
@ramya-rao-a
Copy link
Contributor

This is due to the regex check on build errors happening at https://github.com/Microsoft/vscode-go/blob/master/src/goCheck.ts#L47

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Jan 20, 2017

Such errors do not have a filename/linenumber for the editor to use to show the red squiggly lines.

With #735 you can now this see this error in the output pane.

I'll keep looking at a way to get a visual indicator in the file as well. Maybe a red squiggly in the line that defines the "package" ?

@atombender
Copy link
Author

Yes — errors without a line number can be associated with line 1, in my opinion. Not ideal, but better than no error at all. I use "go to next marker" to find the next error to fix, and obviously the import cycle error doesn't show up that way.

@atombender
Copy link
Author

Awesome -- thanks, @ramya-rao-a!

@ramya-rao-a
Copy link
Contributor

The latest update (0.6.53) has this fix.
Happy Coding!

@atombender
Copy link
Author

Hooray!

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