Skip to content

Commit cbfd4b9

Browse files
Changing handling on all-modules.go and the 'go generate' feature (#355)
# Description When forking the repository, and running "go generate" modules/all-modules.go is created or updated, but since it was previously tracking in the repository it's then added to unstaged files for commit. This is not optimal, as it could potentially mean someone would push their custom all-modules.go file to the main repository. It's already in .gitignore, but since it was already tracked this is not enough to have ti not appear as a changed file when running "go generate". ## Changes - Added a default modules/all-modules.go to the repo - Removed all-modules.go from .gitignore - Removed references to 'go generate' in the Makefile - Removed cmd/generate/_all-modules.go - Added proper sorting of modules in modules-import.go
1 parent 8ebb7e4 commit cbfd4b9

File tree

5 files changed

+6
-32
lines changed

5 files changed

+6
-32
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ _datafiles/**/plugin-data/*
55
**/config-overrides.yaml
66
**/.roundcount
77
vendor/
8-
modules/all-modules.go
98
server.crt
109
server.key
1110
tmp-gomud.exe

Makefile

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,29 +36,21 @@ docker-%:
3636
.PHONY: build_rpi_zero2w
3737
build_rpi_zero2w: generate ### Build a binary for a raspberry pi zero 2w
3838
env GOOS=linux GOARCH=arm64 go build -o $(BIN)-rpi
39-
make ungenerate
4039

4140
.PHONY: build_win64
4241
build_win64: generate ### Build a binary for 64bit windows
4342
env GOOS=windows GOARCH=amd64 go build -o $(BIN)-win64.exe
44-
make ungenerate
4543

4644
.PHONY: build_linux64
4745
build_linux64: generate ### Build a binary for linux
4846
env GOOS=linux GOARCH=amd64 go build -o $(BIN)-linux64
49-
make ungenerate
5047

5148
.PHONY: build
5249
build: validate build_local ### Validate the code and build the binary.
5350

5451
.PHONY: build_local
5552
build_local: generate
5653
CGO_ENABLED=0 go build -trimpath -a -o $(BIN)
57-
make ungenerate
58-
59-
.PHONY: ungenerate
60-
ungenerate: ### Reverts to a clean version of modules/all-modules.go
61-
@cp cmd/generate/_all-modules.go modules/all-modules.go
6254

6355
.PHONY: generate
6456
generate: ### Generates include directives for modules

cmd/generate/_all-modules.go

Lines changed: 0 additions & 16 deletions
This file was deleted.

cmd/generate/module-imports.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"log"
1616
"os"
1717
"path/filepath"
18+
"sort"
1819
"strings"
1920
)
2021

@@ -44,6 +45,7 @@ func main() {
4445
}
4546
}
4647
}
48+
sort.Strings(pkgs)
4749
var buf bytes.Buffer
4850
buf.WriteString("// Code generated by go:generate; DO NOT EDIT.\n\n")
4951
buf.WriteString("// Generated with command: go generate\n")

modules/all-modules.go

Lines changed: 4 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)