GoClipse / goclipse

Eclipse IDE for the Go programming language:
http://goclipse.github.io/
Eclipse Public License 1.0
841 stars 290 forks source link

Outline not working as expected for custom build tag #222

Open nirajbhatt7 opened 7 years ago

nirajbhatt7 commented 7 years ago

I am using custom build tag in some of my GO files. The issue is that "Outline" panel in Eclipse shows error when the build tag is enabled. I was expecting "Outline" not to show error irrespective of the tag is // +build local or // +build !local

Is there a setting that I am missing or is this a bug?

Build Command: ${GO_TOOL_PATH} install -tags local -v -gcflags "-N -l" github.com/nirajbhatt7/Sample

sample.go // +build local

Note: There is a blank line after the build. This builds the project and includes the sample.go but the "Outline" in Eclipse shows an error "Error parsing 'guru describe' result, for source structure update package ......"

sample.go // +build !local

Note: This builds the project and does not include the sample.go. "Outline" in Eclipse does not show any error.

bruno-medeiros commented 7 years ago

Hum, I didn't noticed that issue before. The thing is, the build command does not affect how guru is called, so guru won't be called with -tags local. Ideally guru should always display an outline regardless of build tags, but it doesn't do that.

We could add an option to pass a -tags parameter to guru, but I think that's not very appropriate. What if different go files have different build tags. We would need to configure tags for each individually.

bruno-medeiros commented 7 years ago

I'm trying to think of a better workaround for Goclipse. Perhaps best is to scan the start of the Go file, see if there is any "// +build" command, remove that line if there is one (in a temporary Go file), and call guru describe on that file.

jonpaul commented 7 years ago

I also just ran into this issue, an error like this one: Error parsing 'guru describe' result, for source structure update: no buildable Go source files in /var/folders/hg/k89sj9rs0v1748v1z88h4czh0000gp/T/_goclipse6030531029753758149/src/describe_temp

Kept being generated. This was super confusing until I found this issue. It would sound like the temporary file missing some of the //build lines would be the most simple way forward.

lazytiger commented 7 years ago

Same problem here. I find that any file contains "import C" will fail to show outline.

bruno-medeiros commented 7 years ago

@lazytiger your problem is different, see https://github.com/GoClipse/goclipse/issues/176 . That one I'm afraid cannot be fixed on Goclipse side.