Change 32819

tom_tyler (C. Thomas Tyler)
C. Thomas Tyler committed this change into //p4lf/dev
Request Review
Download .zip
Add version stamping via Perforce keyword expansion.

internal/version/version.go (type text+k):
- SemVer var: hand-maintained Major.Minor.Patch, injectable via -ldflags
- P4ID/P4Change/P4DateTime constants: expanded by Perforce on each submit/sync
- Get() parses expanded keywords into an Info struct (stream, CL, date, revision)
- String() produces: 'p4lf 0.1.0 (CL 32819, //p4lf/dev#3, 2026/06/25)'
- Gracefully handles unexpanded state (pre-first-submit, non-P4 builds)

internal/version/version_test.go:
- Tests stream/revision parsing for dev, main, release streams
- Tests Change and DateTime regex parsing

cmd/p4lf/main.go:
- Uses version.String() and version.SemVer instead of hardcoded const

Makefile:
- VERSION now read from internal/version/version.go
- LDFLAGS target github.com/rcowham/p4lf/internal/version.SemVer
  • Files 4
  • Comments 0
2 edited 2 added 0 deleted
Makefile#2
Loading...
cmd/p4lf/main.go#2
Loading...
internal/version/version.go#1
Loading...
internal/version/version_test.go#1
Loading...
Tip: Use n and p to cycle through the changes.