-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e20f73
commit d85872e
Showing
3 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.vscode/** | ||
bin/** | ||
pkg/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Setup GO Dev Env in Fedora | ||
|
||
* Install: Download golang pkg from https://go.dev/dl/ and install using the wizard. | ||
``` | ||
> go version | ||
go version go1.17.6 darwin/amd64 | ||
``` | ||
|
||
* Install any code editor (I prefer VS Code). | ||
|
||
The `go` and `gofmt` binaries will become available on the system. | ||
|
||
Set `GO111MODULE` to `off` | ||
``` | ||
go env -w GO111MODULE=off | ||
``` | ||
|
||
Go code lives in a workspace which is defined by the GOPATH environment variable. A common choice among developers, and the default value of GOPATH starting from the Go 1.8 release, is to use $HOME/go: | ||
|
||
Check GOPATH set correctly: | ||
``` | ||
[jay@localhost]$ go env GOPATH | ||
/Users/jaydihenkar/go | ||
``` | ||
--- | ||
|
||
Run a simple basic program from this repo. | ||
|
||
Source this project with GOPATH: | ||
``` | ||
> set -x GOPATH (pwd) | ||
> go env GOPATH | ||
/Users/jaydihenkar/work/go_learning | ||
``` | ||
|
||
Run the basic Code: | ||
``` | ||
> go run src/01_basic_of_go/01_basic_of_go.go | ||
Enter the basic go codenum to run: 011 | ||
Hello world.... | ||
36 | ||
j(0)|a(1)|y(2)|D(3)| | ||
3_4_5_6_7_ | ||
15 123 | ||
Inferred type of := 3778 is Type :: int, Size :: 8[bytes] | ||
Inferred type of := 2.37 + 99.42i is Type :: complex128, Size :: 16[bytes] | ||
``` | ||
|
||
You can also run with `make`: | ||
``` | ||
> make run filename=src/01_basic_of_go/01_basic_of_go.go | ||
go env GOPATH | ||
/Users/jaydihenkar/work/go_learning | ||
go run src/01_basic_of_go/01_basic_of_go.go | ||
Enter the basic go codenum to run: 011 | ||
Hello world.... | ||
36 | ||
j(0)|a(1)|y(2)|D(3)| | ||
3_4_5_6_7_ | ||
15 123 | ||
Inferred type of := 3778 is Type :: int, Size :: 8[bytes] | ||
Inferred type of := 2.37 + 99.42i is Type :: complex128, Size :: 16[bytes] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
GOPATH := ${HOME}/work/go_learning | ||
export GOPATH | ||
|
||
run: | ||
go env GOPATH | ||
go run ${filename} |