mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-25 18:55:28 -06:00
hkghghjg
This commit is contained in:
parent
d62f41a4f1
commit
fe99e70983
78
notes/go.notes
Normal file
78
notes/go.notes
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
TODO:
|
||||||
|
|
||||||
|
committing
|
||||||
|
blowing away files:
|
||||||
|
if it's untracked, delete it
|
||||||
|
if it's tracked, check it out
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------
|
||||||
|
GO
|
||||||
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
Running and Building:
|
||||||
|
|
||||||
|
$ go run hello-world.go
|
||||||
|
hello world
|
||||||
|
|
||||||
|
$ go build hello-world.go
|
||||||
|
$ ls
|
||||||
|
hello-world hello-world.go
|
||||||
|
|
||||||
|
$ ./hello-world
|
||||||
|
hello world
|
||||||
|
|
||||||
|
-----------------------------------------------------------
|
||||||
|
DIRECTORY STRUCTURE
|
||||||
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
https://golang.org/doc/code.html
|
||||||
|
|
||||||
|
if you don't have your GOPATH exported, do so with
|
||||||
|
export GOPATH=$(go env GOPATH)
|
||||||
|
|
||||||
|
you have a GOPATH which points to e.g. ~/go/
|
||||||
|
this is where everything in go is stored.
|
||||||
|
|
||||||
|
it has three directories,
|
||||||
|
- src
|
||||||
|
- pkg
|
||||||
|
- bin
|
||||||
|
|
||||||
|
installed programs have their executables stored in bin
|
||||||
|
all your project and the src code of other people's projects are in src, with paths identifying them e.g.
|
||||||
|
src/github.com/jesseduffield/gitgot
|
||||||
|
|
||||||
|
If you want to make an executable, give every file in your project directory `package main`, otherwise if you want to make a package, name everything `package mypackage`. This name should be the name of the project directory for your project.
|
||||||
|
|
||||||
|
to install a program, inside the project folder
|
||||||
|
go install
|
||||||
|
|
||||||
|
This adds the program to /bin
|
||||||
|
|
||||||
|
to build a package, inside the project folder
|
||||||
|
go build
|
||||||
|
|
||||||
|
this adds the package to /pkg so that it can be linked easily in the future.
|
||||||
|
|
||||||
|
to build and run your program just do this:
|
||||||
|
|
||||||
|
~/github.com/jesseduffield/gitgot:
|
||||||
|
▶ go install && gitgot
|
||||||
|
|
||||||
|
-----------------------------------------------------------
|
||||||
|
BUILD SYSTEMS
|
||||||
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
Currently for installs I'm using
|
||||||
|
/Users/jesseduffieldduffield/Library/Application Support/Sublime Text 3/Packages/User/custom_go_install.sublime-build
|
||||||
|
|
||||||
|
note that the argument to go install should be the directory from the end of /src/ onwards.
|
||||||
|
|
||||||
|
-----------------------------------------------------------
|
||||||
|
FMT
|
||||||
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
casting anything to a string
|
||||||
|
fmt.Sprint(thing)
|
Loading…
Reference in New Issue
Block a user