DEV Community

Jorden Williams
Jorden Williams Subscriber

Posted on • Updated on

GoLang Troubles?

So, it's been a few days and have had quite the ride trying to understand what's happening on the backend of the env. So, in my full admission, I made an oopsie in the last post regarding adding Go to your PATH.

I ran into an issue Friday (06/09, (it's always right before the week ends). I reached out to the developer of templ, a-h (huge thanks for pointing me in the right direction), with an issue about my css file being overwritten.

According to everything sent, all was okay. After a couple of days working on it. The issue became clear. My PATH was corrupted. How did I come to this conclusion?

templ generate: command not found

The issue, is not in the way PATH is set up but the ORDER in which it is set up.

Coming from Windie, over to Mac, I didn't consider a key and important aspect. When working in Windie, PATH can be deleted completely if not set correctly (typically can be reset by restarting the PC). On Linux based systems, this is less of a risk when working in the terminal.

"But how?" I hear. Simple, when working in the terminal, your $PATH is loaded into the env. So, by simply changing the code to look like so:

GOPATH=/path/to/go
GOBIN="$GOPATH/bin"

export PATH="$GOBIN:${PATH}"
Enter fullscreen mode Exit fullscreen mode

we resolve the issue.

By appending $PATH to the end of the string, you're preventing duplicate paths. This was, in fact, the issue. Remember what I said last time? "If you run into any problems, I promise, it is mostly a path issue."

Good luck with your project(s) and may you have full bands ahead!

(If you're unsure of what "full bands" means, I have a post for that, coming as well)
Buy Me A Coffee

Top comments (0)