Skip to content

Introductory course to GoLang basics ๐Ÿ‘ท๐Ÿผ๐Ÿšง

Notifications You must be signed in to change notification settings

rahman95/go-crash-course

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

17 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Go Crash Course ๐Ÿ“๐Ÿ’ฅ

Workspace ๐Ÿ—

Run below command to spit out your go enviroment variables.

go env

In the output find the GOPATH variable which will tell you where your workspaces is based, by default this will be a go directory in your home folder.

Go is very opionionated and has a default way of how you should structure your workspace.

|- go
    |- bin
    |- src
        |- github.com
            |- rahman95
                |- go-crash-course
    |- pkg

src

The above shows an example of the default directory layout, all your projects should live under a src directory which will contain a versioning system directory which is github in my case, then under a directory named after your username which is rahman95. In that directory is where all your projects will sit.

bin

In the bin folder is where all your compiled code will live, once you run the compile command on your project it will be found here.

pkg

This is the directory where all third-party packages will sit, whenever you will add a new dependency it should be added there.

Packages โœจ

To add packages to your projects simply use;

go get github.com/aws/aws-sdk-go/aws

This command will fetch the package and place in under the pkg directory. For a list of packages avaialable you can use pkg.go

Run ๐Ÿƒ๐Ÿฝโ€โ™‚๏ธ

To execute a go file you can use the below command

go run <file.go>

Compile ๐Ÿš€

To compile your project, navigate to your project and run the below

go install

This will try compile and place in under the bin folder in your workspace.

About

Introductory course to GoLang basics ๐Ÿ‘ท๐Ÿผ๐Ÿšง

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages