Attempting to establish a GOpath

I am attempting to create a Gopath, however I am getting this annoying error

eloiim:~ iivri.andre$ echo 'echo GOPATH=$HOME' >> $HOME/.profile
eloiim:~ iivri.andre$ source $HOME/.profile
-bash: export: `=': not a valid identifier
-bash: export: `/Users/iivri.andre': not a valid identifier
GOPATH=/Users/iivri.andre
GOPATH=/Users/iivri.andre

THIS is the tutorial that I AM using.

https://howistart.org/posts/go/1#setting-up-your-environment

HOW can I correct this error?

You want

export GOPATH=$HOME

@dfc SO omit the :

echo 'echo GOPATH=$HOME' >> $HOME/.profile

I’m not sure if you’re trying to create instructions for how someone else could configure their Go workspace, or if you are trying to modify your own environment.

I recommend editing $HOME/.profile removing the line

echo GOPATH=$HOME

and adding the line

export GOPATH=$HOME

@dfc well what I am attempting is to just to create the workspace as instructed by the tutorial. I am following it to create the mock website.

Can you please tell me which tutorial you are using? Is it online somewhere?

@dfc, that tutorial link was in the original post (unless it was edited after the fact)

https://howistart.org/posts/go/1#setting-up-your-environment

@iivri, you seem to have misread the tutorial example. The tutorial uses the export keyword instead of echo
If you update it to match the actual text I would think it would work.

Thanks for pointing that out, I didn’t see the original link. I agree with Justin, the instructions in the tutorial are correct in this respect.

1 Like

@dfc @Justin_Israel Thank You 2. I realize the mistake I made. I will make the edits and see if it works.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.