Skip to content

Commit 0aa1a38

Browse files
committed
feat: preparing for release with goreleaser
1 parent cf27329 commit 0aa1a38

File tree

6 files changed

+103
-7
lines changed

6 files changed

+103
-7
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
TeeTimeFinder
22
.vscode
3+
# Added by goreleaser init:
4+
dist/

.goreleaser.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# This is an example .goreleaser.yml file with some sensible defaults.
2+
# Make sure to check the documentation at https://goreleaser.com
3+
4+
# The lines below are called `modelines`. See `:help modeline`
5+
# Feel free to remove those if you don't want/need to use them.
6+
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
7+
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
8+
9+
version: 2
10+
11+
before:
12+
hooks:
13+
# You may remove this if you don't use go modules.
14+
- go mod tidy
15+
# you may remove this if you don't need go generate
16+
# - go generate ./...
17+
18+
builds:
19+
- env:
20+
- CGO_ENABLED=0
21+
goos:
22+
- linux
23+
- windows
24+
- darwin
25+
ldflags:
26+
- -s -w
27+
- -X github.com/Ay1tsMe/TeeTimeFinder/cmd.version={{ .Version }}
28+
- -X github.com/Ay1tsMe/TeeTimeFinder/cmd.commit={{ .Commit }}
29+
- -X github.com/Ay1tsMe/TeeTimeFinder/cmd.date={{ .Date }}
30+
31+
archives:
32+
- formats: [tar.gz]
33+
# this name template makes the OS and Arch compatible with the results of `uname`.
34+
name_template: >-
35+
{{ .ProjectName }}_
36+
{{- title .Os }}_
37+
{{- if eq .Arch "amd64" }}x86_64
38+
{{- else if eq .Arch "386" }}i386
39+
{{- else }}{{ .Arch }}{{ end }}
40+
{{- if .Arm }}v{{ .Arm }}{{ end }}
41+
# use zip for windows archives
42+
format_overrides:
43+
- goos: windows
44+
formats: [zip]
45+
46+
changelog:
47+
sort: asc
48+
filters:
49+
exclude:
50+
- "^docs:"
51+
- "^test:"

cmd/root.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ type startFormModel struct {
4242
blacklist map[string]bool
4343
}
4444

45+
// For releases
46+
var (
47+
appName = "TeeTimeFinder"
48+
version, commit, date = "dev", "dev", "1970-01-01" // date gets overridden when built
49+
)
50+
4551
var allowedStandardModifiers = map[string]bool{
4652
"walking": true,
4753
"midweek": true,
@@ -89,6 +95,7 @@ func Execute() {
8995
}
9096

9197
func init() {
98+
rootCmd.AddCommand(versionCmd(os.Stdout))
9299
rootCmd.PersistentFlags().StringVarP(&specifiedTime, "time", "t", "", "Filter times within 1 hour before and after the specified time (e.g., 12:00)")
93100
rootCmd.PersistentFlags().StringVarP(&specifiedDate, "date", "d", "", "Specify the date for the tee time search (format: DD-MM-YYYY)")
94101
rootCmd.PersistentFlags().IntVarP(&specifiedSpots, "spots", "s", 0, "Filter timeslots based on available player spots (1-4)")

cmd/version.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package cmd
2+
3+
import (
4+
"fmt"
5+
"io"
6+
7+
"github.com/spf13/cobra"
8+
)
9+
10+
func versionCmd(out io.Writer) *cobra.Command {
11+
cmd := &cobra.Command{
12+
Use: "version",
13+
Short: "Print version info",
14+
Run: func(_ *cobra.Command, _ []string) {
15+
printVersion(out)
16+
},
17+
}
18+
19+
return cmd
20+
}
21+
22+
func printVersion(out io.Writer) {
23+
const format = "%-10s %s\n"
24+
25+
fmt.Fprintf(out, format, "Version:", version)
26+
fmt.Fprintf(out, format, "Commit:", commit)
27+
fmt.Fprintf(out, format, "Date:", date)
28+
}

go.mod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,42 @@ module TeeTimeFinder
33
go 1.23.1
44

55
require (
6+
github.com/PuerkitoBio/goquery v1.10.0
7+
github.com/charmbracelet/bubbles v0.21.0
8+
github.com/charmbracelet/bubbletea v1.3.5
9+
github.com/charmbracelet/lipgloss v1.1.0
610
github.com/gocolly/colly v1.2.0
711
github.com/spf13/cobra v1.8.1
812
github.com/stretchr/testify v1.11.1
913
)
1014

1115
require (
12-
github.com/PuerkitoBio/goquery v1.10.0 // indirect
1316
github.com/andybalholm/cascadia v1.3.2 // indirect
1417
github.com/antchfx/htmlquery v1.3.2 // indirect
1518
github.com/antchfx/xmlquery v1.4.1 // indirect
1619
github.com/antchfx/xpath v1.3.1 // indirect
17-
github.com/davecgh/go-spew v1.1.1 // indirect
1820
github.com/atotto/clipboard v0.1.4 // indirect
1921
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
20-
github.com/charmbracelet/bubbles v0.21.0 // indirect
21-
github.com/charmbracelet/bubbletea v1.3.5 // indirect
2222
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect
2323
github.com/charmbracelet/harmonica v0.2.0 // indirect
24-
github.com/charmbracelet/lipgloss v1.1.0 // indirect
2524
github.com/charmbracelet/x/ansi v0.8.0 // indirect
2625
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect
2726
github.com/charmbracelet/x/term v0.2.1 // indirect
27+
github.com/davecgh/go-spew v1.1.1 // indirect
2828
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
2929
github.com/gobwas/glob v0.2.3 // indirect
3030
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
3131
github.com/golang/protobuf v1.5.4 // indirect
3232
github.com/inconshreveable/mousetrap v1.1.0 // indirect
3333
github.com/kennygrant/sanitize v1.2.4 // indirect
34-
github.com/pmezard/go-difflib v1.0.0 // indirect
3534
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
3635
github.com/mattn/go-isatty v0.0.20 // indirect
3736
github.com/mattn/go-localereader v0.0.1 // indirect
3837
github.com/mattn/go-runewidth v0.0.16 // indirect
3938
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
4039
github.com/muesli/cancelreader v0.2.2 // indirect
4140
github.com/muesli/termenv v0.16.0 // indirect
41+
github.com/pmezard/go-difflib v1.0.0 // indirect
4242
github.com/rivo/uniseg v0.4.7 // indirect
4343
github.com/sahilm/fuzzy v0.1.1 // indirect
4444
github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect

go.sum

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z
1212
github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
1313
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
1414
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
15+
github.com/aymanbagabas/go-udiff v0.2.0 h1:TK0fH4MteXUDspT88n8CKzvK0X9O2xu9yQjWpi6yML8=
16+
github.com/aymanbagabas/go-udiff v0.2.0/go.mod h1:RE4Ex0qsGkTAJoQdQQCA0uG+nAzJO/pI/QwceO5fgrA=
1517
github.com/charmbracelet/bubbles v0.21.0 h1:9TdC97SdRVg/1aaXNVWfFH3nnLAwOXr8Fn6u6mfQdFs=
1618
github.com/charmbracelet/bubbles v0.21.0/go.mod h1:HF+v6QUR4HkEpz62dx7ym2xc71/KBHg+zKwJtMw+qtg=
1719
github.com/charmbracelet/bubbletea v1.3.5 h1:JAMNLTbqMOhSwoELIr0qyP4VidFq72/6E9j7HHmRKQc=
@@ -26,6 +28,8 @@ github.com/charmbracelet/x/ansi v0.8.0 h1:9GTq3xq9caJW8ZrBTe0LIe2fvfLR/bYXKTx2ll
2628
github.com/charmbracelet/x/ansi v0.8.0/go.mod h1:wdYl/ONOLHLIVmQaxbIYEC/cRKOQyjTkowiI4blgS9Q=
2729
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd h1:vy0GVL4jeHEwG5YOXDmi86oYw2yuYUGqz6a8sLwg0X8=
2830
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs=
31+
github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payRxjMjKgx2PaCWLZ4p3ro9y97+TVLZNaRZgJwSVDQ=
32+
github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U=
2933
github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ=
3034
github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg=
3135
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
@@ -50,7 +54,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2
5054
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
5155
github.com/kennygrant/sanitize v1.2.4 h1:gN25/otpP5vAsO2djbMhF/LQX6R7+O1TB4yv8NzpJ3o=
5256
github.com/kennygrant/sanitize v1.2.4/go.mod h1:LGsjYYtgxbetdg5owWB2mpgUL6e2nfw2eObZ0u0qvak=
53-
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
57+
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
58+
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
5459
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
5560
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
5661
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
@@ -65,6 +70,7 @@ github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELU
6570
github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo=
6671
github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc=
6772
github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk=
73+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
6874
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
6975
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
7076
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
@@ -89,6 +95,8 @@ github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJu
8995
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
9096
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
9197
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
98+
golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561 h1:MDc5xs78ZrZr3HMQugiXOAkSZtfTpbJLDr/lwfgO53E=
99+
golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE=
92100
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
93101
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
94102
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=

0 commit comments

Comments
 (0)