Skip to content

Commit

Permalink
add mac setup
Browse files Browse the repository at this point in the history
  • Loading branch information
jkdihenkar committed Jan 9, 2022
1 parent 8e20f73 commit d85872e
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.vscode/**
bin/**
pkg/**
63 changes: 63 additions & 0 deletions 01_setup_dev_env_mac.md
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]
```
6 changes: 6 additions & 0 deletions Makefile
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}

0 comments on commit d85872e

Please sign in to comment.