Create initial Go module

Ref #1

Create an initial Go module with a simple unit test and a makefile. This
can be tested using a CI pipeline, which will ensure that the following
commits don't break anything.
This commit is contained in:
Melora Hugues 2023-01-05 18:51:53 +01:00
parent 0e1f5f15de
commit bd9bba54ba
5 changed files with 33 additions and 0 deletions

3
.gitignore vendored
View file

@ -15,6 +15,9 @@
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# build directory
tracker/build
# Dependency directories (remove the comment below to include it)
# vendor/

7
tracker/Makefile Normal file
View file

@ -0,0 +1,7 @@
.PHONY: build test
build:
go build -o build/
test:
go test -v ./...

3
tracker/go.mod Normal file
View file

@ -0,0 +1,3 @@
module git.faercol.me/faercol/public-ip-tracker/tracker
go 1.16

11
tracker/main.go Normal file
View file

@ -0,0 +1,11 @@
package main
import "fmt"
func testMethod(a int) int {
return a + 2
}
func main() {
fmt.Println("public ip tracker")
}

9
tracker/main_test.go Normal file
View file

@ -0,0 +1,9 @@
package main
import "testing"
func TestTestMethod(t *testing.T) {
if testMethod(12) != 14 {
t.Fatalf("Unexpected result %d", testMethod((12)))
}
}