hello world project

This commit is contained in:
Robert Jeutter 2021-12-30 20:34:36 +01:00
parent c7bee051a5
commit abe8ee6c91
4 changed files with 31 additions and 0 deletions

3
1-hello-world/go.mod Normal file
View File

@ -0,0 +1,3 @@
module example/user/hello
go 1.17

BIN
1-hello-world/hello Executable file

Binary file not shown.

7
1-hello-world/hello.go Normal file
View File

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Printf("hello, world\n")
}

21
1-hello-world/readme.md Normal file
View File

@ -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
```