For installing Goland or any other of the Jetbrains tools I recommend using the Jetbrains Toolbox. Link This makes installing and updating Goland a trivial matter and is available for free
Once you have started Goland.
- Click 'configure' button in the lower right corner
- Click 'settings'
- Click 'Go' on the top
- Click 'Go Modules (vgo)'
- Check 'Enable Go Modules (vgo) integration'
- Apply and Exit settings
Once you have created your golang-project
- Open a terminal
- Write
go mod init github.com/<username>/<repository>
- Create
main.go
- Create
src/yourmodule/yourmodule.go
- Remember to capitalize the functions and types that you want exported from the class
- Use the function in
main.go
and save - Goland should now have automatically added an import statement for your new function
- Run the program by either
- Right-clicking on
main.go -> 'run go build main.go'
- Writing
go build main.go && ./main
- Right-clicking on
.
├── src
| └── yourmodule
| └── yourmodule.go
└── mod.go
└── main.go