1- # Go Repository Template
1+ # twu
22
3- [ ![ Keep a Changelog] ( https://img.shields.io/badge/changelog-Keep%20a%20Changelog-%23E05735 )] ( CHANGELOG.md )
3+ <!-- [](CHANGELOG.md)
44[](https://github.com/golang-templates/seed/releases)
55[](https://pkg.go.dev/github.com/golang-templates/seed)
66[](go.mod)
1111
1212⭐ `Star` this repository if you find it valuable and worth maintaining.
1313
14- 👁 ` Watch ` this repository to get notified about new releases, issues, etc.
15-
16- ## Description
17-
18- This is a GitHub repository template for a Go application.
19- You can use it:
20-
21- - to create a new repository with automation and environment setup,
22- - as reference when improving automation for an existing repository.
23-
24- It includes:
25-
26- - continuous integration via [ GitHub Actions] ( https://github.com/features/actions ) ,
27- - build automation via [ Make] ( https://www.gnu.org/software/make ) ,
28- - dependency management using [ Go Modules] ( https://github.com/golang/go/wiki/Modules ) ,
29- - code formatting using [ gofumpt] ( https://github.com/mvdan/gofumpt ) ,
30- - linting with [ golangci-lint] ( https://github.com/golangci/golangci-lint )
31- and [ misspell] ( https://github.com/client9/misspell ) ,
32- - unit testing with
33- [ race detector] ( https://blog.golang.org/race-detector ) ,
34- code coverage [ HTML report] ( https://blog.golang.org/cover )
35- and [ Codecov report] ( https://codecov.io/ ) ,
36- - releasing using [ GoReleaser] ( https://github.com/goreleaser/goreleaser ) ,
37- - dependencies scanning and updating thanks to [ Dependabot] ( https://dependabot.com ) ,
38- - security code analysis using [ CodeQL Action] ( https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/about-code-scanning ) ,
39- - [ Visual Studio Code] ( https://code.visualstudio.com ) configuration with [ Go] ( https://code.visualstudio.com/docs/languages/go ) support.
40-
41- ## Usage
42-
43- 1 . Sign up on [ Codecov] ( https://codecov.io/ ) and configure
44- [ Codecov GitHub Application] ( https://github.com/apps/codecov ) .
45- 1 . Click the ` Use this template ` button (alt. clone or download this repository).
46- 1 . Replace all occurrences of ` golang-templates/seed ` to ` your_org/repo_name ` in all files.
47- 1 . Replace all occurrences of ` seed ` to ` repo_name ` in [ Dockerfile] ( Dockerfile ) .
48- 1 . Follow [ these] ( https://docs.codecov.com/docs/adding-the-codecov-token#github-actions )
49- instructions to add the ` CODECOV_TOKEN ` GitHub Actions and Dependabot secret.
50- 1 . Update the following files:
51- - [ CHANGELOG.md] ( CHANGELOG.md )
52- - [ CODE_OF_CONDUCT.md] ( CODE_OF_CONDUCT.md )
53- - [ LICENSE] ( LICENSE )
54- - [ README.md] ( README.md )
14+ 👁 `Watch` this repository to get notified about new releases, issues, etc. -->
5515
56- ## Setup
16+ ` twu ` consumes the [ OpenWeatherMap API] ( https://openweathermap.org/current ) to provide weather information for a given city.
17+
18+ It's built with Go and uses [ HTMX] ( https://htmx.org/ ) to make the application interactive without writing _ any_ JavaScript.
19+
20+ ## Quickstart
21+
22+ * To run the application, execute the following commands:
23+
24+ ``` bash
25+ # run the application
26+ go run main.go
27+
28+ # quit the application
29+ Ctrl + C
30+ ```
31+
32+ * Once it' s running, you can access the application at `http://localhost:8080`.
33+ * To build the application, execute the following commands:
5734
58- Below you can find sample instructions on how to set up the development environment.
59- Of course, you can use other tools like [ GoLand] ( https://www.jetbrains.com/go/ ) ,
60- [ Vim] ( https://github.com/fatih/vim-go ) , [ Emacs] ( https://github.com/dominikh/go-mode.el ) .
61- However, take notice that the Visual Studio Go extension is
62- [ officially supported] ( https://blog.golang.org/vscode-go ) by the Go team.
35+ ```bash
36+ # build the application
37+ go build -o ./build/twu .
38+ ```
39+
40+ * To run the built application, execute the following commands:
41+
42+ ```bash
43+ # run the application
44+ ./build/twu
45+ ```
46+
47+ * To run the tests, execute the following commands:
48+
49+ ```bash
50+ # run the tests
51+ go test ./...
52+ ```
53+
54+ ## Setup
6355
64561. Install [Go](https://golang.org/doc/install).
65- 1 . Install [ Visual Studio Code] ( https://code.visualstudio.com/ ) .
66- 1 . Install [ Go extension] ( https://code.visualstudio.com/docs/languages/go ) .
67- 1 . Clone and open this repository.
68- 1 . ` F1 ` -> ` Go: Install/Update Tools ` -> (select all) -> OK.
57+ 2 . Install [Visual Studio Code](https://code.visualstudio.com/).
58+ 3 . Install [Go extension](https://code.visualstudio.com/docs/languages/go).
59+ 4 . Clone and open this repository.
60+ 5 . `F1` -> `Go: Install/Update Tools` -> (select all) -> OK.
6961
7062## Build
7163
7264### Terminal
7365
74- - ` make ` - execute the build pipeline.
75- - ` make help ` - print help for the [ Make targets] ( Makefile ) .
66+ * `make`: execute the build pipeline.
67+ * `make help`: print help for the [Make targets](Makefile).
7668
7769### Visual Studio Code
7870
@@ -90,63 +82,15 @@ More info: [Go Wiki](https://github.com/golang/go/wiki/Modules#releasing-modules
9082
9183Notable files:
9284
93- - [ .github/workflows] ( .github/workflows ) - GitHub Actions workflows,
94- - [ .github/dependabot.yml] ( .github/dependabot.yml ) - Dependabot configuration,
95- - [ .vscode] ( .vscode ) - Visual Studio Code configuration files,
96- - [ .golangci.yml] ( .golangci.yml ) - golangci-lint configuration,
97- - [ .goreleaser.yml] ( .goreleaser.yml ) - GoReleaser configuration,
98- - [ Dockerfile] ( Dockerfile ) - Dockerfile used by GoReleaser to create a container image,
99- - [ Makefile] ( Makefile ) - Make targets used for development, [ CI build] ( .github/workflows ) and [ .vscode/tasks.json] ( .vscode/tasks.json ) ,
100- - [ go.mod] ( go.mod ) - [ Go module definition] ( https://github.com/golang/go/wiki/Modules#gomod ) ,
101- - [ tools.go] ( tools.go ) - [ build tools] ( https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module ) .
102-
103- ## FAQ
104-
105- ### Why Visual Studio Code editor configuration
106-
107- Developers that use Visual Studio Code can take advantage of the editor configuration.
108- While others do not have to care about it.
109- Setting configs for each repo is unnecessary time consuming.
110- VS Code is the most popular Go editor ([ survey] ( https://blog.golang.org/survey2019-results ) )
111- and it is officially [ supported by the Go team] ( https://blog.golang.org/vscode-go ) .
112-
113- You can always remove the [ .vscode] ( .vscode ) directory if it really does not help you.
114-
115- ### Why GitHub Actions, not any other CI server
116-
117- GitHub Actions is out-of-the-box if you are already using GitHub.
118- [ Here] ( https://github.com/mvdan/github-actions-golang ) you can learn how to use it for Go.
119-
120- However, changing to any other CI server should be very simple,
121- because this repository has build logic and tooling installation in [ Makefile] ( Makefile ) .
122-
123- ### How can I build on Windows
124-
125- Install [ tdm-gcc] ( https://jmeubank.github.io/tdm-gcc/ )
126- and copy ` C:\TDM-GCC-64\bin\mingw32-make.exe `
127- to ` C:\TDM-GCC-64\bin\make.exe ` .
128- Alternatively, you may install [ mingw-w64] ( http://mingw-w64.org/doku.php )
129- and copy ` mingw32-make.exe ` accordingly.
130-
131- Take a look [ here] ( https://github.com/docker-archive/toolbox/issues/673#issuecomment-355275054 ) ,
132- if you have problems using Docker in Git Bash.
133-
134- You can also use [ WSL (Windows Subsystem for Linux)] ( https://docs.microsoft.com/en-us/windows/wsl/install-win10 )
135- or develop inside a [ Remote Container] ( https://code.visualstudio.com/docs/remote/containers ) .
136- However, take into consideration that then you are not going to use "bare-metal" Windows.
137-
138- Consider using [ goyek] ( https://github.com/goyek/goyek )
139- for creating cross-platform build pipelines in Go.
140-
141- ### How can I customize the release
142-
143- Take a look at GoReleaser [ docs] ( https://goreleaser.com/customization/ )
144- as well as [ its repo] ( https://github.com/goreleaser/goreleaser/ )
145- how it is dogfooding its functionality.
146- You can use it to add deb/rpm/snap packages, Homebrew Tap, Scoop App Manifest etc.
147-
148- If you are developing a library and you like handcrafted changelog and release notes,
149- you are free to remove any usage of GoReleaser.
85+ * [.github/workflows](.github/workflows) - GitHub Actions workflows,
86+ * [.github/dependabot.yml](.github/dependabot.yml) - Dependabot configuration,
87+ * [.vscode](.vscode) - Visual Studio Code configuration files,
88+ * [.golangci.yml](.golangci.yml) - golangci-lint configuration,
89+ * [.goreleaser.yml](.goreleaser.yml) - GoReleaser configuration,
90+ * [Dockerfile](Dockerfile) - Dockerfile used by GoReleaser to create a container image,
91+ * [Makefile](Makefile) - Make targets used for development, [CI build](.github/workflows) and [.vscode/tasks.json](.vscode/tasks.json),
92+ * [go.mod](go.mod) - [Go module definition](https://github.com/golang/go/wiki/Modules#gomod),
93+ * [tools.go](tools.go) - [build tools](https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module).
15094
15195## Contributing
15296
0 commit comments