quan-xie / goclipse

Automatically exported from code.google.com/p/goclipse
0 stars 0 forks source link

Unable to build any go program with goclipse plugin #90

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.I work on windows 7 with eclipse Indigo Service Release 2
2.I have installed the latest go release (go1)
3.I have built a simple go main file

What is the expected output? What do you see instead?
instead of building my file i see an error line in error log view : 

   Unexpected internal error near index 1

Here is the stack trace : 
java.util.regex.PatternSyntaxException: Unexpected internal error near index 1
\
 ^
    at java.util.regex.Pattern.error(Unknown Source)
    at java.util.regex.Pattern.compile(Unknown Source)
    at java.util.regex.Pattern.<init>(Unknown Source)
    at java.util.regex.Pattern.compile(Unknown Source)
    at java.lang.String.split(Unknown Source)
    at java.lang.String.split(Unknown Source)
    at com.googlecode.goclipse.builder.GoBuilder.computePackagePath(Unknown Source)
    at com.googlecode.goclipse.builder.GoBuilder.doBuild(Unknown Source)
    at com.googlecode.goclipse.builder.GoBuilder.fullBuild(Unknown Source)
    at com.googlecode.goclipse.builder.GoBuilder.build(Unknown Source)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
    at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
    at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

What version of the product are you using? On what operating system?
  - windows 7 with eclipse Indigo Service Release 2
  - the latest go release (go1)

Please provide any additional information below.
  - before i had an exception caused by the missing GOPATH environment variable, i had to set this variable to : 
GOPATH=B:\Program Files\programmation\go\src
GOROOT=B:\Program Files\programmation\go

Thanks

Original issue reported on code.google.com by milak....@gmail.com on 3 Apr 2012 at 7:42

GoogleCodeExporter commented 9 years ago
i changed my GOPATH env variable to B:\Program Files\programmation\go but the 
issue is the same

Original comment by milak....@gmail.com on 3 Apr 2012 at 8:49

GoogleCodeExporter commented 9 years ago
It sounds like the bug is in the function located in 
http://code.google.com/p/goclipse/source/browse/trunk/goclipse-n/src/com/googlec
ode/goclipse/builder/GoBuilder.java : 
/**
         * 
         * @param file
         * @return
         */
        public final String computePackagePath(File file) {
                IProject project = getProject();
                final IPath projectLocation = project.getLocation();
                final IFile ifile = project.getFile(file.getAbsolutePath().replace(project.getLocation().toOSString(), ""));

                IPath pkgFolder = Environment.INSTANCE.getPkgOutputFolder();
                String pkgname  = ifile.getParent().getLocation().toOSString();
                pkgname = pkgname.replace(projectLocation.toOSString(), "");
                String[] split = pkgname.split(File.separatorChar=='\\' ? "\\\\" : File.separator);
                String path = projectLocation.toOSString()+"/"+pkgFolder;
                for(int i = 2; i< split.length; i++){
                        path += "/"+split[i];
                }

                return path+GoConstants.GO_LIBRARY_FILE_EXTENSION;
        }

At line :  String[] split = pkgname.split(File.separatorChar=='\\' ? "\\\\" : 
File.separator);

Original comment by milak....@gmail.com on 3 Apr 2012 at 9:14

GoogleCodeExporter commented 9 years ago
To reproduce the same exception i just haad to write this code :
"toto".split("\\");

Original comment by milak....@gmail.com on 4 Apr 2012 at 8:11

GoogleCodeExporter commented 9 years ago
Can you update and try again

Original comment by st...@kryas.com on 6 Apr 2012 at 5:22

GoogleCodeExporter commented 9 years ago
great it works !  you can close the ticket

Original comment by milak....@gmail.com on 7 Apr 2012 at 7:04

GoogleCodeExporter commented 9 years ago

Original comment by st...@kryas.com on 7 Apr 2012 at 8:11