eclipse-che / che-dockerfiles

Eclipse Public License 2.0
86 stars 107 forks source link

Update centos_go dockerfile #224

Closed jarifibrahim closed 3 years ago

jarifibrahim commented 6 years ago

What does this PR do?

What issues does this PR fix or reference?

N/A

Previous behavior

The GOPATH was set to /projects/.che

New behavior

The GOPATH is now set to /projects/go

Tests written?

No

Docs updated?

N/A

ibuziuk commented 6 years ago

@jarifibrahim could you please explain why do you want to change /projects/.che to /projects/go ? AFAIK, this folder will appear in the project explorer by default and will be treated like a project in IDE

jarifibrahim commented 6 years ago

@jarifibrahim could you please explain why do you want to change /projects/.che to /projects/go ? AFAIK, this folder will appear in the project explorer by default and will be treated like a project in IDE

@ibuziuk I am not changing /projects/.che to /projects/go, I've changed the value of GOPATH environment variable which is used to store all golang projects. Currently, the projects are stored in /projects directory which the go binary cannot find. $GOPATH is used by the go binary to figure out where the project is and where to put the binaries. A go project is usually in $GOPATH/src/.... but currently the GOPATH=/projects/.che and project source code is in /projects directory. That's why I want to change it.

The existing sample projects work fine with the currect setup but if I want to use a tool like dep the projects needs to be inside the $GOPATH/src/ directory

Please see https://golang.org/doc/code.html#GOPATH for more information.

After this PR is merged, the project explorer would show

go/
   | -- bin/
   | -- src/ 
   | -- pkg

I would like to show only the src/xyz/foo (actual) project. Is there any way to change the Project path? If I change the path of the CHE_PROJECT_ROOT would the project explorer show the correct output? Also is there a way to change the project root at Runtime?

ibuziuk commented 6 years ago

@garagatyi could you please take a look at this PR ? Do not think that approach with having go inside /projects is the right one.

garagatyi commented 6 years ago

@ibuziuk I'm not sure whether this approach would work with IDE, factories and workspace projects correctly. I added Eugene, maybe he knows

ghost commented 6 years ago

It should. But there will be bin and pkg directories in /projects that will be treated as projects by GWT IDE. Otherwise it should work just fine.

jarifibrahim commented 6 years ago

It should. But there will be bin and pkg directories in /projects that will be treated as projects by GWT IDE. Otherwise it should work just fine.

@eivantsov I think it would be fine if we show the bin and pkg directory. If I install a golang project binary, I should be able to see it. This is just like a nodejs project where the user gets to see node_modules also.

If there is a better way to accomplish this, I would be more than happy to implement it :)

garagatyi commented 5 years ago

I don't think that I'm a good candidate to review PRs in this repo. Up to Eugene to decide here

ghost commented 5 years ago

@jarifibrahim as long as you have tested it with a custom image and it works for you, I am fine with changes

jarifibrahim commented 5 years ago

Thanks @eivantsov. I'll check once again if everything works fine. We can merge after that.

jarifibrahim commented 5 years ago

The dockerfile doesn't work (my bad). The workspace created using this image in the stack has directory structure like

projects/
    |  go/
    |  foobar/

The idea was to get foobar inside the correct directory inside $GOPATH/ (go/) directory. A go project like github.com/xyz/foobar should be in $GOPATH/src/github.com/xyz/foobar directory but that isn't happening right now.

jarifibrahim commented 3 years ago

I don't think this PR is relevant anymore. Closing it.