Skip to content

Commit 8f30c6c

Browse files
go: add module
1 parent 704ea06 commit 8f30c6c

File tree

6 files changed

+58
-1
lines changed

6 files changed

+58
-1
lines changed

template/go/.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# https://github.com/github/gitignore/blob/main/Go.gitignore
2+
3+
# If you prefer the allow list template instead of the deny list, see community template:
4+
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
5+
#
6+
# Binaries for programs and plugins
7+
*.exe
8+
*.exe~
9+
*.dll
10+
*.so
11+
*.dylib
12+
13+
# Test binary, built with `go test -c`
14+
*.test
15+
16+
# Output of the go coverage tool, specifically when used with LiteIDE
17+
*.out
18+
19+
# Dependency directories (remove the comment below to include it)
20+
# vendor/
21+
22+
# Go workspace file
23+
go.work
24+
go.work.sum
25+
26+
# env file
27+
.env

template/go/flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
55

6-
outputs = { self, nixpkgs }:
6+
outputs = { nixpkgs, ... }:
77
let
88
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
99
in

template/go/go.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/minizilla/go-project
2+
3+
go 1.22.1
4+
5+
require github.com/minizilla/testr v0.4.0 // indirect

template/go/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github.com/minizilla/testr v0.4.0 h1:pHy2U8TFgpBpQS15ZMqQS3h2/msyZ0GKSpGW6xMBabA=
2+
github.com/minizilla/testr v0.4.0/go.mod h1:DdZPGzN8GgQbC2QZ24W/BaWI88xCKUKQ6YLcV/g3hvQ=

template/go/main.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package main
2+
3+
import "fmt"
4+
5+
func greet() string {
6+
return "Hello, World!"
7+
}
8+
9+
func main() {
10+
fmt.Println(greet())
11+
}

template/go/main_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package main
2+
3+
import (
4+
"testing"
5+
6+
"github.com/minizilla/testr"
7+
)
8+
9+
func TestGreet(t *testing.T) {
10+
is := testr.New(t)
11+
is.Equal(greet(), "Hello, World!")
12+
}

0 commit comments

Comments
 (0)