On Thursday, 12 October 2017 09:28:42 UTC+11, Pat Farrell wrote: > Yes, I didn't understand what a "workspace" is. Still don't know what that buzzword means.
I suggested you read https://golang.org/doc/code.html - it should answer your question. But if you prefer me explaining it (and I am not as good as people who wrote the doco), when you write programs with Go all your source code, compiled packages and final binaries will be stored inside of single directory on your computer. It is up to you to decide where that directory is, but all Go tools would expect to find that directory path in GOPATH environment variable. All your source files have to be stored under %GOPATH%\src, all compiled packages will go into %GOPATH%\pkg and all compiled binaries will be installed into %GOPATH%\bin. So, if you do ``` set GOPATH=c:\gopath ``` then create this file ``` c:\gopath\src\hello>type main.go package main import "fmt" func main() { fmt.Println("Helle") } c:\gopath\src\hello> ``` in c:\gopath\src\hello directory and then run "go install hello" command, it will create c:\gopath\bin\hello.exe with your program. "go install" and "go build" commands do not care about source file names, they care about package names, and package name is determined by the directory where your source files are stored. For example the same file could be copied into c:\gopath\src\a\b\c\alex directory, and then you would have to do "go install a/b/c/alex" to build and install it, and that would create c:\gopath\bin\alex.exe executable. Hopefully this will get you started, but there is much more to Go tools. You should start learning by reading https://golang.org/doc/code.html > So I created a directory in my sandbox called 'go' and got go.exe Yes. "go build" command uses directory name to decide what the package name is, and therefore what the output binary will be called. You could use -o flag to override that, but you should try and live by Go conventions first, you might discover that these work for you. > That thread is at least a year old. Back then it was in Beta from MS. Its released now. Sure. But Go is still not supported on WSL. There were few issues reported about Go on WSL (you could search https://golang.org/issue ). Some of them are quite basic, like deleting all files in a directory does not delete all files. If you want to use development environment with bugs, then sure, you could do that. Just start here https://golang.org/doc/install but use Linux instructions, not Windows instructions. > But I'm trying to learn go and while I have three or four Linux machines and an OS-X one, my day to day laptop is Windows because I need Lightroom, Photoshop and Premier, and I am tired of paying for Apple's over priced, under performing laptops. Go works pretty much the same on any OS (bar file paths and couple of small things). Same commands, same tools. You can build any Go program on any OS for any OS (except when your program uses any libraries written in C). So whatever OS you prefer is fine. Some people use Plan 9 to develop in Go. > Go is claimed to be cross platform, and the language sure looks to be that way. But the installation instructions on Windows seem to be an afterthought and fairly out of date. It is hard for me to judge (I have used Go for many years). If you think you could improve the documentation, you are welcome to contribute https://golang.org/doc/contribute.html > I'm surprised that the default Windows binary installation still installs the gnu / cygwin stuff which has never "supported" anything. Go, its libraries and tools are written in Go. So Go installation does not installs any gnu / cygwin stuff. Give me an example, if you know otherwise. Alex -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.