diff --git a/1-hello-world/go.mod b/1-hello-world/go.mod new file mode 100644 index 0000000..df78b6c --- /dev/null +++ b/1-hello-world/go.mod @@ -0,0 +1,3 @@ +module example/user/hello + +go 1.17 diff --git a/1-hello-world/hello b/1-hello-world/hello new file mode 100755 index 0000000..a08a3a5 Binary files /dev/null and b/1-hello-world/hello differ diff --git a/1-hello-world/hello.go b/1-hello-world/hello.go new file mode 100644 index 0000000..aa465c2 --- /dev/null +++ b/1-hello-world/hello.go @@ -0,0 +1,7 @@ +package main + +import "fmt" + +func main() { + fmt.Printf("hello, world\n") +} \ No newline at end of file diff --git a/1-hello-world/readme.md b/1-hello-world/readme.md new file mode 100644 index 0000000..01c030d --- /dev/null +++ b/1-hello-world/readme.md @@ -0,0 +1,21 @@ +# Hello World +Steps to reproduce +```bash +mkdir 1-hello-world +cd 1-hello-world +go mod init example/user/hello +cat go.mod +# first statement in a Go source file must be package name. Executable commands must always use package main. + +# to run +go run hello.go + +# to build and run binary +go build +./hello + +# to install binary to system +go install example/user/hello +# or +go install +``` \ No newline at end of file