Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.0] Libraries and gopath and projects inside gopath #1163

Closed
dlsniper opened this issue Jan 6, 2015 · 12 comments
Closed

[1.0] Libraries and gopath and projects inside gopath #1163

dlsniper opened this issue Jan 6, 2015 · 12 comments
Assignees
Milestone

Comments

@dlsniper
Copy link
Member

dlsniper commented Jan 6, 2015

Hello,

I have the following setup:

  • go 1.4 in /usr/local/go
  • gopath in /home/florin/golang

I'm using v1.0.0-alpha0 branch with revision 547ddaa and the PR #1115 on top of it.

As you can see in the screenshot below, something is wrong either with my setup for the gopath library for the project or in the code as:

  • import "github.com/dlsniper/misc/hashtables" is saying: cannot resolve directory XYZ where XYZ is the directory I have my cursor over (can be any of github.com, dlsniper ...)
  • main() is flagged as duplicate function

However the code does offer to import github.com/dlsniper/misc/hashtables if I hover the line demo := hashtables.NewHashtable(10)
The code is available on github if you need it.

Thank you.

snapshot84

--- EDIT

I've also noticed that if I create a new project by importing existing sources, the Go library isn't attached to the project anymore even if it's defined in the Languages & Frameworks -> Go Libraries -> For current project Global Libraries section.

Hope this helps.

@dlsniper dlsniper added this to the 1.0.0 milestone Jan 6, 2015
@ignatov ignatov assigned zolotov and unassigned ignatov Jan 6, 2015
@zolotov
Copy link
Contributor

zolotov commented Jan 9, 2015

Please enable DEBUG level log for "com.goide.project.GoModuleLibrariesInitializer" (Help | Configure debug log settings), reopen project and attach logs

@dlsniper
Copy link
Member Author

dlsniper commented Jan 9, 2015

I've done that and I get the following entries in the logs:


2015-01-09 15:41:46,549 [ 390053]   INFO - t.GoModuleLibrariesInitializer - The directory is ancestor of project root, looking deeper: /home/florin/golang/src 
2015-01-09 15:41:46,549 [ 390053]   INFO - t.GoModuleLibrariesInitializer - Add directory to GOPATH library: /home/florin/golang/src/github.com/dlsniper/maze 
2015-01-09 15:41:46,549 [ 390053]   INFO - t.GoModuleLibrariesInitializer - The directory is project root, skipping: /home/florin/golang/src/github.com/dlsniper/misc 
2015-01-09 15:41:46,549 [ 390053]   INFO - t.GoModuleLibrariesInitializer - Add directory to GOPATH library: /home/florin/golang/src/github.com/dlsniper/wrigi 
2015-01-09 15:41:46,549 [ 390053]   INFO - t.GoModuleLibrariesInitializer - Add directory to GOPATH library: /home/florin/golang/src/github.com/dlsniper/random 
2015-01-09 15:41:46,549 [ 390053]   INFO - t.GoModuleLibrariesInitializer - Add directory to GOPATH library: /home/florin/golang/src/github.com/dlsniper/cortana 
2015-01-09 15:41:46,549 [ 390053]   INFO - t.GoModuleLibrariesInitializer - Add directory to GOPATH library: /home/florin/golang/src/github.com/dlsniper/logalyzer 

My setup is like this:

  • GOPATH -> /home/florin/golang
  • IntelliJ Go libraries -> Global Libraries -> /home/florin/golang/src (if I skip the src folder, the output is the same)
  • my project is under -> /home/florin/golang/src/github.com/dlsniper/misc

It should also be noted that if I create a project in /home/florin/golang/src, things won't work as well, with or without having the libraries in place. I believe that this will cause confusion as people will expect that the IDE should be able to consider that the GOPATH is /home/florin/golang and work with that. Maybe it's worth considering enforcing the settings after the IDE starts for the first time with the plugin. My use case is the the first one described here

@dlsniper
Copy link
Member Author

dlsniper commented Jan 9, 2015

I should mention that only those lines of logs appear in the logs for the GoModuleLibrariesInitializer entry. All the other go packages that I have under /home/florin/golang/src are not listed.
If you need more info, please ping me on Gitter, I'll reply as soon as I can.

Thank you!

@zolotov
Copy link
Contributor

zolotov commented Jan 9, 2015

Please check out the update. Should be fixed now

@zolotov zolotov closed this as completed Jan 9, 2015
@dlsniper dlsniper reopened this Jan 9, 2015
@dlsniper
Copy link
Member Author

dlsniper commented Jan 9, 2015

Thanks for the quick reply. Now the libraries get attached to the project but for example the imports code will still not see the import path as valid. Would it help if I'd make a screen recording? Or I can do a hangouts / remote desktop to better understand the problem. Thank you.

@zolotov
Copy link
Contributor

zolotov commented Jan 9, 2015

Would it help if I'd make a screen recording?

Yes please.

Or I can do a hangouts / remote desktop to better understand the problem

I believe screencast would be enough

@dlsniper
Copy link
Member Author

dlsniper commented Jan 9, 2015

Here it is http://youtu.be/BSpkyJQ9FdY

@ignatov
Copy link
Contributor

ignatov commented Jan 9, 2015

Please attach your log. I saw a ClassCast exception in your video.

@dlsniper
Copy link
Member Author

dlsniper commented Jan 9, 2015

@ignatov that one is reported here: https://youtrack.jetbrains.com/issue/IDEA-124756 and I've already reported it via the auto-reporting facility (you can see it below). The plugin doesn't throw any exceptions.

2015-01-09 18:36:44,565 [6321236]  ERROR - llij.ide.plugins.PluginManager - IntelliJ IDEA (Cassiopeia) IU-139.872.1  Build #IU-139.872.1 
2015-01-09 18:36:44,565 [6321236]  ERROR - llij.ide.plugins.PluginManager - JDK: 1.8.0_25 
2015-01-09 18:36:44,565 [6321236]  ERROR - llij.ide.plugins.PluginManager - VM: Java HotSpot(TM) 64-Bit Server VM 
2015-01-09 18:36:44,565 [6321236]  ERROR - llij.ide.plugins.PluginManager - Vendor: Oracle Corporation 
2015-01-09 18:36:44,565 [6321236]  ERROR - llij.ide.plugins.PluginManager - OS: Linux 
2015-01-09 18:36:44,565 [6321236]  ERROR - llij.ide.plugins.PluginManager - Last Action: ShowSettings 
2015-01-09 18:36:44,626 [6321297]  ERROR - llij.ide.plugins.PluginManager - sun.awt.image.BufImgSurfaceData cannot be cast to sun.java2d.xr.XRSurfaceData 
java.lang.ClassCastException: sun.awt.image.BufImgSurfaceData cannot be cast to sun.java2d.xr.XRSurfaceData
    at sun.java2d.xr.XRPMBlitLoops.cacheToTmpSurface(XRPMBlitLoops.java:145)
    at sun.java2d.xr.XrSwToPMBlit.Blit(XRPMBlitLoops.java:353)
    at sun.java2d.loops.BlitBg$General.BlitBg(BlitBg.java:180)
    at sun.java2d.pipe.DrawImage.blitSurfaceData(DrawImage.java:971)
    at sun.java2d.pipe.DrawImage.renderImageCopy(DrawImage.java:585)
    at sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:67)
    at sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:1022)
    at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:3318)
    at sun.awt.image.ImageRepresentation.drawToBufImage(ImageRepresentation.java:813)
    at sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:1029)
    at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:3318)
    at com.intellij.codeHighlighting.HighlightDisplayLevel$SingleColorIconWithMask.paintIcon(HighlightDisplayLevel.java:159)
    at com.intellij.codeInsight.daemon.impl.TrafficLightRenderer.paint(TrafficLightRenderer.java:240)
    at com.intellij.openapi.editor.impl.EditorMarkupModelImpl$ErrorStripeButton.paint(EditorMarkupModelImpl.java:461)
    at javax.swing.JComponent.paintChildren(JComponent.java:886)
    at javax.swing.JComponent.paint(JComponent.java:1062)
    at com.intellij.openapi.editor.impl.EditorImpl$MyScrollBar.paint(EditorImpl.java:4840)
    at javax.swing.JComponent.paintChildren(JComponent.java:886)
    at javax.swing.JComponent.paint(JComponent.java:1062)
    at javax.swing.JComponent.paintChildren(JComponent.java:886)
    at javax.swing.JComponent.paint(JComponent.java:1062)
    at javax.swing.JLayeredPane.paint(JLayeredPane.java:586)
    at javax.swing.JComponent.paintChildren(JComponent.java:886)
    at javax.swing.JComponent.paint(JComponent.java:1062)
    at javax.swing.JComponent.paintChildren(JComponent.java:886)
    at javax.swing.JComponent.paint(JComponent.java:1062)
    at javax.swing.JComponent.paintChildren(JComponent.java:886)
    at javax.swing.JComponent.paint(JComponent.java:1062)
    at javax.swing.JLayeredPane.paint(JLayeredPane.java:586)
    at javax.swing.JComponent.paintChildren(JComponent.java:886)
    at javax.swing.JComponent.paint(JComponent.java:1062)
    at javax.swing.JComponent.paintChildren(JComponent.java:886)
    at javax.swing.JComponent.paint(JComponent.java:1062)
    at javax.swing.JComponent.paintChildren(JComponent.java:886)
    at javax.swing.JComponent.paint(JComponent.java:1062)
    at javax.swing.JComponent.paintChildren(JComponent.java:886)
    at javax.swing.JComponent.paint(JComponent.java:1062)
    at javax.swing.JComponent.paintChildren(JComponent.java:886)
    at com.intellij.ui.tabs.impl.JBTabsImpl.paintChildren(JBTabsImpl.java:2291)
    at javax.swing.JComponent.paint(JComponent.java:1062)
    at com.intellij.ui.tabs.impl.JBTabsImpl.paint(JBTabsImpl.java:2286)
    at javax.swing.JComponent.paintChildren(JComponent.java:886)
    at javax.swing.JComponent.paint(JComponent.java:1062)
    at javax.swing.JComponent.paintChildren(JComponent.java:886)
    at javax.swing.JComponent.paint(JComponent.java:1062)
    at javax.swing.JComponent.paintChildren(JComponent.java:886)
    at javax.swing.JComponent.paint(JComponent.java:1062)
    at javax.swing.JComponent.paintChildren(JComponent.java:886)
    at javax.swing.JComponent.paint(JComponent.java:1062)
    at javax.swing.JComponent.paintChildren(JComponent.java:886)
    at javax.swing.JComponent.paint(JComponent.java:1062)
    at javax.swing.JComponent.paintChildren(JComponent.java:886)
    at javax.swing.JComponent.paint(JComponent.java:1062)
    at javax.swing.JLayeredPane.paint(JLayeredPane.java:586)
    at javax.swing.JComponent.paintChildren(JComponent.java:886)
    at com.intellij.openapi.wm.impl.ToolWindowsPane.paintChildren(ToolWindowsPane.java:185)
    at javax.swing.JComponent.paint(JComponent.java:1062)
    at javax.swing.JLayeredPane.paint(JLayeredPane.java:586)
    at javax.swing.JComponent.paintChildren(JComponent.java:886)
    at javax.swing.JComponent.paint(JComponent.java:1062)
    at javax.swing.JComponent.paintChildren(JComponent.java:886)
    at javax.swing.JComponent.paint(JComponent.java:1062)
    at javax.swing.JLayeredPane.paint(JLayeredPane.java:586)
    at javax.swing.JComponent.paintChildren(JComponent.java:886)
    at javax.swing.JComponent.paintToOffscreen(JComponent.java:5230)
    at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1572)
    at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1495)
    at javax.swing.RepaintManager.paint(RepaintManager.java:1265)
    at javax.swing.JComponent.paint(JComponent.java:1039)
    at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:39)
    at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:79)
    at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:116)
    at java.awt.Container.paint(Container.java:1973)
    at java.awt.Window.paint(Window.java:3901)
    at com.intellij.openapi.wm.impl.IdeFrameImpl.paint(IdeFrameImpl.java:513)
    at javax.swing.RepaintManager$4.run(RepaintManager.java:835)
    at javax.swing.RepaintManager$4.run(RepaintManager.java:807)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:807)
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:782)
    at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:731)
    at javax.swing.RepaintManager.access$1300(RepaintManager.java:64)
    at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1720)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:744)
    at java.awt.EventQueue.access$400(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:697)
    at java.awt.EventQueue$3.run(EventQueue.java:691)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:714)
    at com.intellij.ide.IdeEventQueue.e(IdeEventQueue.java:748)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:577)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:384)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

@dlsniper
Copy link
Member Author

If it helps, I've noticed that while writing code, autocomplete for unimported packages public functions / structures / variables work. As soon as I hit enter and auto-import kicks in, always importing the correct package, the package is flagged as invalid (cannot resolve issue) and the reference for it as well.

@zolotov
Copy link
Contributor

zolotov commented Jan 28, 2015

Fixed, please check it out

@zolotov zolotov closed this as completed Jan 28, 2015
@dlsniper
Copy link
Member Author

IT WORKS! Good job. THANK YOU!

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

No branches or pull requests

3 participants