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
class HelloWorld: | |
def __init__(self, name): | |
self.name = name.capitalize() | |
def sayHi(self): | |
print "Hello " + self.name + "!" | |
hello = HelloWorld("world") | |
hello.sayHi() |
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
package main | |
import "testing" | |
func Test(t *testing.T) { | |
blah(t, func() {}) | |
blah2(t, func() { panic("oh dear") }) | |
} | |
func blah(t *testing.T, f func()) { |
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
$ go test -v -run="Script/command\$" myitcv.io/cmd/gg | |
=== RUN TestScripts | |
=== RUN TestScripts/command | |
=== PAUSE TestScripts/command | |
=== CONT TestScripts/command | |
--- PASS: TestScripts (0.06s) | |
--- PASS: TestScripts/command (10.84s) | |
<autogenerated>:1: | |
WORK=$WORK | |
HOME=/no-home |
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
Hello, World! | |
Paul Jolly | |
[email protected] | |
https://myitcv.io | |
@_myitcv | |
* Today we will | |
- Learn how to say, "Hello, World!" |
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
bash | |
( | |
set -eux | |
command cd $(mktemp -d) | |
export GOPATH=$(mktemp -d) | |
export PATH=$GOPATH/bin:$PATH | |
git clone https://github.com/ianthehat/godef | |
command cd godef | |
git checkout f2eb530fb8dbca312f4661b985ec2ae5ba5e7b3a | |
go install |
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
$ mkdir -p /home/gopher/scratchpad/submodulestest | |
$ cd /home/gopher/scratchpad/submodulestest | |
$ git init -q | |
$ git remote add origin https://github.com/go-modules-by-example-staging/submodulestest | |
$ go mod init github.com/go-modules-by-example-staging/submodulestest | |
go: creating new go.mod: module github.com/go-modules-by-example-staging/submodulestest | |
$ mkdir b | |
$ cd b | |
$ cat <<EOD >b.go | |
package b |
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
SCRIPT /home/myitcv/.vim/ftplugin/go.vim | |
Sourced 1 time | |
Total time: 0.000160 | |
Self time: 0.000160 | |
count total (s) self (s) | |
1 0.000065 nmap <buffer> <Leader>h : <C-u>call go#tool#Info(0)<CR> | |
1 0.000024 nmap <F6> :GoImports<CR> |
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
set -eo pipefail | |
export GOPATH=$(mktemp -d) | |
export GO111MODULE=off | |
go get golang.org/x/tools/cmd/goimports | |
cd $(go list -f "{{.Dir}}" golang.org/x/tools/go/packages) | |
git fetch https://go.googlesource.com/tools refs/changes/97/142697/6 && git checkout FETCH_HEAD | |
sed -i 's/^var Debug = false$/var Debug = true/' golist.go | |
sed -i '/cmd\.Env = append/c\cmd.Env = append(append([]string{}, cfg.Env...), "PWD="+cfg.Dir, "GOPROXY=off")' golist.go | |
go install golang.org/x/tools/cmd/goimports | |
export GO111MODULE=on |
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
( | |
set -eo pipefail | |
export GOPATH=$(mktemp -d) | |
export GO111MODULE=off | |
go get golang.org/x/tools/cmd/goimports | |
cd $(go list -f "{{.Dir}}" golang.org/x/tools/go/packages) | |
git fetch https://go.googlesource.com/tools refs/changes/97/142697/6 && git checkout FETCH_HEAD | |
sed -i 's/^var Debug = false$/var Debug = true/' golist.go | |
go install golang.org/x/tools/cmd/goimports | |
export GO111MODULE=on |
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
$ GO111MODULE=off go get github.com/myitcv/gobin | |
$ gobin github.com/rogpeppe/gohack | |
Installed github.com/rogpeppe/[email protected] to /home/gopher/gopath/bin/gohack | |
$ gobin github.com/rogpeppe/gomodmerge | |
Installed github.com/rogpeppe/[email protected] to /home/gopher/gopath/bin/gomodmerge | |
$ cd $(mktemp -d) | |
$ go mod init example.com/hello | |
$ cat <<EOD >main.go | |
package main |
NewerOlder