schwarzit / go-template Goto Github PK
View Code? Open in Web Editor NEWgo/template is a tool for jumpstarting production-ready Golang projects quickly.
License: Apache License 2.0
go/template is a tool for jumpstarting production-ready Golang projects quickly.
License: Apache License 2.0
After generating a project using the Apache 2.0 license, I've discovered that the current year and my name were replaced with the placeholders that should be there in the license file.
These placeholders should not be replaced. See e.g. the Google guidelines https://opensource.google/documentation/reference/releasing/preparing#license-file:
For the Apache License, simply copy the official 2.0 license into your LICENSE file verbatim (do not edit the Copyright section in the template, only when you use that template in the header of your source code files.) [...]
Why shouldn't I edit the template in the Apache License? The "LICENSE" file is supposed to be our inclusion of an exact copy of https://www.apache.org/licenses/LICENSE-2.0.txt as required by section 4(a) of the Apache 2 license, so we shouldn't modify it in any way, such as by adding our copyright notice. Also, the Appendix (lines 179-202) represents a notice to third-parties informing them of how they should apply the Apache 2 license to their own works, so inserting our copyright notice in place of the template text renders those instructions incorrect. Many projects insert copyright notices into their LICENSE file at line 190 because this is a common and understandable misinterpretation of the license's instructions. We should attempt to fix this wherever we find it, particularly for first-party projects.
Run gt new
and select the Apache 2.0 license. Inspect the generated LICENSE file, in line 190 and see that the placeholders of the original license have been replaced.
0.3.0
The main repo does it right (
Line 190 in d97730d
The golint
for golangci is deprecated
. Maybe replace it with revive
?
WARN [runner] The linter 'golint' is deprecated (since v1.41.0) due to: The repository of the linter has been archived by the owner. Replaced by revive.
revive
repo -> https://github.com/mgechev/revive
Renovate updates update the go.sum file but not the nix lockfile which breaks the nix derivation.
Probably an additional renovate step is required to fix that.
-
No response
It is mandatory to run go generate
whenever new files are added to make sure that all dotfiles are included in the embedded template.
Therefore we need a validation step in the pipeline that the generated file is up to date.
I created a new project with gt new
and disabled the grpc extension but I still got the buf.work.yaml
file.
run gt new
and set false
for the grpc extension.
0.4.0
No response
Makefiles are fast hard to read & to maintain. It would be nice to have a more elgant alternative like earthly.
Replace current Makefile with an Earthly file. Earthly could also be split up into multiple files & folders. So this could also help to make go-template
fit for more options, since not everything needs to be going into one file.
Also with earthly, supporting multiple CI provider would be much easier.
Keep the Makefile ๐
No response
When creating a project with gRPC support, the command make protobreaking
checks only against master
branch.
Better would be checking against the current main branch and not hard-coded a specific branch.
Create a new project with gRPC
support and run make protobreaking
where no master branch exists.
0.4.0
No response
The release pipeline run https://github.com/SchwarzIT/go-template/actions/runs/3394226442 fails because of some templating issue.
See pipeline
-
No response
It's useful for 12factor apps.
Set Zap logging level through an environment var.
Example for debug: LOG_LEVEL=debug
...
No response
tag_release
pipeline creates a tag trough the github rest api which apparently does not trigger the release workflow (which triggers on: push: tag: *).
Try to use the release flow described in the release docs using the hack/release.sh script.
-
No response
It should be documented that gt
requires git and go to be installed and available on PATH
.
Otherwise the new
command fails.
Currently, in the CI the protobuf files will not be linted.
Nice would be to add them into the make ci
command and also make sure that this will be integrated into all generated CI's provider.
Also add the linting to the pre-commit.
Some way that the protobuf files will be linted.
No response
When creating a new project with a -
in the name like test-gt
and enable gRPC. The generated protobuffer package name and the example service will contain also the -
but this is invalid for protobuffer.
Create a new project which contains a -
in the name like test-gt
.
0.4.0
No response
The Docker image is currently using a fixed go v1.20 for the builds.
go-template/_template/Dockerfile
Line 4 in 1152abd
We should probably update that to use golang:alpine
without a fixed hash, to always build with the latest Go version. This would bring important security updates, and we wouldn't need to change the version on every new Go release.
blocked by #313
โฏ make generate
PATH=/private/tmp/awesome-project/bin:$PATH buf generate
api/proto/awesome-project/v1/awesome-project.proto:3:17:syntax error: unexpected '-', expecting ';'
make: *** [generate] Error 100
Create a new project using the following file (gt new -c values.yaml
):
# values.yaml
base:
projectName: Testing Project
projectSlug: testing-project
projectDescription: Some project used for testing
appName: testing-project
moduleName: github.com/fake/testing
golangciVersion: 1.42.1
extensions:
grpc:
base: true
Then run make generate
.
0.3.0
Probably the issue is the newly added support for dashes in appNames which are not allowed in protobuf.
There is a missing documentation about automaxprocs
.
How does it works and what does it?
Not all Makefile commands are suitable for all projects. Also the current Makefile is not really suitable for extensions since it's already packed with targets and tends to get confusing.
To improve readability the Makefile should be moved into mutliple default Makefile targetted at specific usecases and then be included in a main Makefile.
In this Makefile it's then also possible to add targets specific to the project.
Enable in semgrep.yml Upload findings to GitHub Advanced Security Dashboard
.
We currently use zap
in internal/log
.
Since Go v1.21 slog
was introduced to the Go stdlib, and it aims to replace all external logging libraries. We should adapt the template and remove the internal/log
package, as the users do not need it anymore (and should prefer to use slog).
We can discuss if we want to initialize slog in the template, or if we want to let the user do that.
When running gt new
and using the defaults and setting grpc.base
to false the files are deleted properly.
When doing the same but setting opensource.license
to 9 (no license) the files are still present after generating.
Currently only lowercase letters are allowed in the appName
during initialization.
When looking at a lot of executables out there (e.g. k3s
or semgrep-agent
) this might be a bit too aggressively validated.
Therefore we should probably also allow underscores, dashes and numbers in the appName
.
Buf is already part of the template to support gRPC projects. Sadly it's outdated and should support the new v1 version and probably also remote plugins.
An update of the existing buf support.
No response
When generating a new project. The main file has a linting error (shadow import) for the logger.
Generate a new project.
0.4.0
Add in CI a linter for the generated project.
Currently the Dockerfile is based on a local binary that is already built which is then just copied into the Container Image.
For a lot of usecases (e.g. pipelines to allow remote caches, devspace setup) the experience can be improved by building the app directly in the Dockerfile instead of building it upfront.
This is why build targets should be added to the Dockerfile.
Currently it's required to set the new version tag manually when running make release
.
Since we're using semantic commits we can instead use caarlos0/svu
to calculate the new release version automatically.
No response
When creating a new no OpenSource project, a codeowner files will be generated.
Create a new project and select for License No OpenSource
0.4.1
No response
Github Discussions should be enabled on the repo to allow anyone to ask questions and raise discussions without instantly opening an issue.
Documentation on the following topics/ questions should be improved:
The asciinema preview is often outdated and also requires a webplayer to run.
It would nice to create the demo automatically and include it in the README as a svg animation to autoplay as soon as a user opens the repo.
https://github.com/brumhard/krewfile already contains a script to automatically create the animation.
One thing that is missing is how to feed stdin to the executed command.
This issue provides visibility into Renovate updates and their statuses. Learn more
This repository currently has no open or pending branches.
Due to golang/go#43854 the go:embed
directive does not include dotfiles and empty directories (or dirs that only contain dotfiles such as .gitkeep). Because of this the created project directory when running gt new
does not contain the all those files.
Not related to a problem, I'm suggesting an improvement to the Dockerfile
Add the --link option to the COPY from the build stage into the final distroless stage.
COPY --from=build --link /app/main /
This will improve cache efficiency and allow for image rebasing (e.g. when there's a new distroless image release, Docker can just rebase the previous build onto the new image)
However, this isn't supported on older Docker versions without support for Dockerfile 1.4
Alternatives:
If this feature request is accepted, I can work on this.
https://www.docker.com/blog/image-rebase-and-improved-remote-cache-support-in-new-buildkit/
https://github.com/moby/buildkit/blob/dockerfile/1.4.0/frontend/dockerfile/docs/syntax.md#linked-copies-copy---link-add---link
We currently only have a minimal goreleaser setup. This could be enriched with the following:
gt new
No, just an enhancement.
Add an Option to create a local (dev) docker-compose setup with fully working containers like:
This could help to create working dev environment.
Just keep the plain Dockerfile.
No response
go/template
v2So after around 1,5 years of using go/template
we see some room for improvement in several parts.
Anyways, go-template
currently only supports one embedded template as the source of truth and we found out that this can't support all the different requirements that arise in different projects, e.g. switching out the build tool etc or supporting a new technology.
Also there has always been this conflict between providing too much and needing to delete a lot or too few to really be relevant.
Since yesterday the golangci installation from the Makefile
is broken.
$ curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b bin v1.42.1
> golangci/golangci-lint info checking GitHub for tag 'v1.42.1'
> golangci/golangci-lint info found version: 1.42.1 for v1.42.1/linux/amd64
> golangci/golangci-lint info installed bin/golangci-lint
> golangci/golangci-lint err this script is deprecated, please do not use it anymore. check https://github.com/goreleaser/godownloader/issues/207
> go mod download
> bin/golangci-lint run
> level=error msg="Running error: context loading failed: no go files to analyze"
There a several other ways to install golangci โ https://golangci-lint.run/usage/install/
Which version do we want to use?
Release PRs just edit the version.txt file but trigger the whole CI workflow which is just a waste of resources.
Ignore updates to the version file in the CI.
No response
To improve CICD integration of go/template
we should add some pipeline templates for a basic linting setup running the make ci
target.
This issue is to discuss the CICD integration for azure devops specifically.
To improve CICD integration of go/template
we should add some pipeline templates for a basic linting setup running the make ci
target.
This issue is to discuss the CICD integration for github specifically.
goreleaser is a commonly used tool in the Go ecosystem to build binaries for several platforms, create a GitHub release and then for example push a Homebrew formula to a tap repository (as well as an expanding list of other targets).
It would be great to also add it as an extension to the template.
Docs are a bit outdated currently.
Things that should be added/updated:
Testing multiple go versions is not required for the tests.
It creates manual effort at times since required checks from old PRs are outdated after go version updates.
Just test one go version.
No response
When creating a new project. The githook pre-push is no more executable.
Create a new project with gt
and make all && git push
.
0.4.0
Please add a test in the CI for that.
Proposal for CI Simplification
Our current setup involves using multiple Continuous Integration (CI) tools, which is rather extensive for a project of our scale, particularly for a CLI tool. This proposal suggests streamlining our CI processes by consolidating tools and adopting simpler, more integrated solutions.
Transition from Renovate to Dependabot (DONE)
Remove semgrep
(DONE)
semgrep
workflow is outdated and has been causing obstructions in our PR process.Adopt a Standard GoReleaser Configuration
.tar.gz
files for macOS/Linux and .zip
files for Windows. Incorporating the README.md
and LICENSE
files into these archives will provide users with essential information in a convenient format.These changes aim to simplify our CI setup, improve efficiency, and align our processes with community standards, thereby enhancing our project's maintainability and accessibility.
To make sure that all the code that is uploaded to the remote repo is in a nice format and optimized there is currently a linting step as pre-push step.
To further improve that it could be beneficial to also add go fmt
and go mod tidy
to pre push to make sure the code is well formatted and all the dependencies are tidied up.
Also we could think of removing the filter to only run these checks if go files are commited, since this could lead to false negatives if only the linting config is changed but no go files. Also the performance impact isn't too bad.
No known problem.
Currently this project auto generated SBOM with syft. After attemting the SBOM Devroom on the fosdem I'm currious if ORT will be generating a better SBOM than syft.
Ort claims, that it will include not just software dependencies from the package manager, it will also include warpped libs like from C++. Also, is has an Open Source Policy Checker included.
If this works as promised, we could run ORT on each PR for OpenSource licencing check and generate the SBOM with it.
Keep using syft
No response
Currently, in the CI the Dockerfile file will not be linted.
Nice would be to add them into the make CI command and also make sure that this will be integrated into all generated CI's provider.
Some way that the Dockerfile file will be linted.
No response
Currently the README only points to the options.go
file where all the options are defined.
Unfortunately it requires some effort to understand how the options are defined and how the whole definition works in the file.
To improve the user experience some docs should be added on the available options. This could be as Markdown or some yaml definition or anything human readable.
It could also be autogenerated maybe from the options.go definitions.
If you run gt new
and generate a new folder (selected options do not matter) all the files will have the executable bit set.
Run gt new
and take a look at the generated files.
0.3.0
No response
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.