Add GoModule support to template context and update gitignore

- Add GoModule struct with Module and Version fields
- Parse go.mod file to extract module name and Go version
- Expose GoModule in template context as {{.GoModule}}
- Update asset templates to use {{.GoModule}} instead of hardcoded values
- Add gitignore pattern for testdata directories (keep only plugin.json files)
- All templates now have access to both manifest and Go module information

Templates can now use:
- {{.GoModule.Module}} for module name
- {{.GoModule.Version}} for Go version
- {{if .GoModule}}...{{end}} for conditional logic

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Felipe M 2025-07-14 22:16:41 +02:00
parent 04fa4154b3
commit 2e2a95d7d6
No known key found for this signature in database
GPG key ID: 52E5D65FCF99808A
4 changed files with 62 additions and 9 deletions

View file

@ -6,7 +6,7 @@ linters-settings:
gofmt:
simplify: true
goimports:
local-prefixes: github.com/mattermost/mattermost-starter-template
local-prefixes: {{.GoModule}}
govet:
check-shadowing: true
enable-all: true

View file

@ -33,7 +33,7 @@ endif
mock:
ifneq ($(HAS_SERVER),)
go install github.com/golang/mock/mockgen@v1.6.0
mockgen -destination=server/command/mocks/mock_commands.go -package=mocks github.com/mattermost/mattermost-plugin-starter-template/server/command Command
mockgen -destination=server/command/mocks/mock_commands.go -package=mocks {{.GoModule}}/server/command Command
endif
## Show help documentation.