Skip to content

Commit ffaca3b

Browse files
authored
module template: no need to modify meta.json when building on Windows (#5063)
Per discussion in viam-modules/mlmodel-tflite#35, #4969, and on Slack, Windows is smart enough to know that if you try executing `foo` and the only file present is `foo.exe`, that's the one to use. So, no need to rewrite meta.json to add the `.exe` suffix on Windows. This also makes the code less surprising: if I modify meta.json myself and then build without committing, I don't expect that to discard my changes! 😳
1 parent b0685a7 commit ffaca3b

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

cli/module_generate/_templates/go/tmpl-Makefile

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ MODULE_BINARY := bin/{{ .ModuleName }}
55

66
ifeq ($(VIAM_TARGET_OS), windows)
77
GO_BUILD_ENV += GOOS=windows GOARCH=amd64
8-
GO_BUILD_FLAGS := -tags no_cgo
8+
GO_BUILD_FLAGS := -tags no_cgo
99
MODULE_BINARY = bin/{{ .ModuleName }}.exe
1010
endif
1111

@@ -23,15 +23,10 @@ test:
2323
go test ./...
2424

2525
module.tar.gz: meta.json $(MODULE_BINARY)
26-
ifeq ($(VIAM_TARGET_OS), windows)
27-
jq '.entrypoint = "./bin/{{ .ModuleName }}.exe"' meta.json > temp.json && mv temp.json meta.json
28-
else
26+
ifneq ($(VIAM_TARGET_OS), windows)
2927
strip $(MODULE_BINARY)
3028
endif
3129
tar czf $@ meta.json $(MODULE_BINARY)
32-
ifeq ($(VIAM_TARGET_OS), windows)
33-
git checkout meta.json
34-
endif
3530

3631
module: test module.tar.gz
3732

0 commit comments

Comments
 (0)