-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ccd653a
Showing
22 changed files
with
485 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
name: CI | ||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Init Hermit | ||
run: ./bin/hermit env -r >> $GITHUB_ENV | ||
- name: golangci-lint | ||
run: golangci-lint run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Release | ||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- run: ./bin/hermit env --raw >> $GITHUB_ENV | ||
- run: goreleaser release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.hermit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
run: | ||
tests: true | ||
timeout: 5m | ||
skip-dirs: | ||
- resources | ||
- old | ||
skip-files: | ||
- cmd/protopkg/main.go | ||
|
||
output: | ||
print-issued-lines: false | ||
|
||
linters: | ||
enable-all: true | ||
disable: | ||
- maligned | ||
- megacheck | ||
- lll | ||
- typecheck # `go build` catches this, and it doesn't currently work with Go 1.11 modules | ||
- goimports # horrendously slow with go modules :( | ||
- dupl # has never been actually useful | ||
- gochecknoglobals | ||
- gochecknoinits | ||
- interfacer # author deprecated it because it provides bad suggestions | ||
- funlen | ||
- whitespace | ||
- godox | ||
- wsl | ||
- dogsled | ||
- gomnd | ||
- gocognit | ||
- gocyclo | ||
- scopelint | ||
- godot | ||
- nestif | ||
- testpackage | ||
- goerr113 | ||
- gci | ||
- gofumpt | ||
- exhaustivestruct | ||
- nlreturn | ||
- forbidigo | ||
- cyclop | ||
- paralleltest | ||
- ifshort # so annoying | ||
- golint | ||
- tagliatelle | ||
- gomoddirectives | ||
- varnamelen | ||
- ireturn | ||
- containedctx | ||
- nilnil | ||
- contextcheck | ||
- nonamedreturns | ||
- exhaustruct | ||
- nosnakecase | ||
- nosprintfhostport | ||
- nilerr | ||
- goconst | ||
- prealloc | ||
- deadcode # doesn't support generics | ||
- varcheck # doesn't support generics | ||
- structcheck # doesn't support generics | ||
- rowserrcheck # doesn't support generics | ||
- wastedassign # doesn't support generics | ||
- goprintffuncname | ||
- dupword | ||
- errchkjson | ||
- musttag | ||
- gofmt # autofmt | ||
- interfacebloat | ||
- tagalign | ||
- nolintlint | ||
- wrapcheck # We might want to re-enable this if we manually wrap all the existing errors with fmt.Errorf | ||
|
||
linters-settings: | ||
exhaustive: | ||
default-signifies-exhaustive: true | ||
govet: | ||
check-shadowing: true | ||
use-installed-packages: true | ||
dupl: | ||
threshold: 100 | ||
goconst: | ||
min-len: 8 | ||
min-occurrences: 3 | ||
gocyclo: | ||
min-complexity: 20 | ||
gocritic: | ||
disabled-checks: | ||
- ifElseChain | ||
depguard: | ||
rules: | ||
main: | ||
deny: | ||
- pkg: github.com/pkg/errors | ||
desc: "use fmt.Errorf or errors.New" | ||
- pkg: github.com/stretchr/testify | ||
desc: "use fmt.Errorf or errors.New" | ||
- pkg: github.com/alecthomas/errors | ||
desc: "use fmt.Errorf or errors.New" | ||
- pkg: braces.dev/errtrace | ||
desc: "use fmt.Errorf or errors.New" | ||
|
||
issues: | ||
max-same-issues: 0 | ||
max-issues-per-linter: 0 | ||
exclude-use-default: false | ||
exclude: | ||
# Captured by errcheck. | ||
- "^(G104|G204):" | ||
# Very commonly not checked. | ||
- 'Error return value of .(.*\.Help|.*\.MarkFlagRequired|(os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*Print(f|ln|)|os\.(Un)?Setenv). is not checked' | ||
# Weird error only seen on Kochiku... | ||
- "internal error: no range for" | ||
- 'exported method `.*\.(MarshalJSON|UnmarshalJSON|URN|Payload|GoString|Close|Provides|Requires|ExcludeFromHash|MarshalText|UnmarshalText|Description|Check|Poll|Severity)` should have comment or be unexported' | ||
- "composite literal uses unkeyed fields" | ||
- 'declaration of "err" shadows declaration' | ||
- "by other packages, and that stutters" | ||
- "Potential file inclusion via variable" | ||
- "at least one file in a package should have a package comment" | ||
- "bad syntax for struct tag pair" | ||
- "should have comment or be unexported" | ||
- "package-comments" | ||
- "parameter testing.TB should have name tb" | ||
- "blank-imports" | ||
- 'should have comment \(or a comment on this block\) or be unexported' | ||
- caseOrder | ||
- unused-parameter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
project_name: autoquery | ||
release: | ||
github: | ||
owner: thnxdev | ||
name: autoquery | ||
brews: | ||
- | ||
install: bin.install "autoquery" | ||
env: | ||
- CGO_ENABLED=0 | ||
builds: | ||
- goos: | ||
- linux | ||
- darwin | ||
- windows | ||
goarch: | ||
- arm64 | ||
- amd64 | ||
- "386" | ||
goarm: | ||
- "6" | ||
dir: ./cmd/autoquery | ||
main: . | ||
ldflags: -s -w -X main.version={{.Version}} | ||
binary: autoquery | ||
archives: | ||
- | ||
format: tar.gz | ||
name_template: '{{ .Binary }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ | ||
.Arm }}{{ end }}' | ||
files: | ||
- COPYING | ||
- README* | ||
snapshot: | ||
name_template: SNAPSHOT-{{ .Commit }} | ||
checksum: | ||
name_template: '{{ .ProjectName }}-{{ .Version }}-checksums.txt' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (C) 2024 thanks.dev | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
of the Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# autoquery is a tool for generating sqlc queries from Go comments | ||
|
||
![CI](https://github.com/thnxdev/autoquery/actions/workflows/ci.yml/badge.svg) | ||
|
||
### Example: | ||
|
||
``` | ||
/* autoquery name: GetChargesSyncable :many | ||
SELECT ... | ||
*/ | ||
``` | ||
|
||
### CLI | ||
|
||
``` | ||
ubuntu@macbook:autoquery$ autoquery --help | ||
Usage: autoquery [<pkg>] | ||
autoquery is a tool for generating sqlc queries from Go comments | ||
Example: | ||
/* autoquery name: GetChargesSyncable :many | ||
SELECT ... | ||
*/ | ||
Arguments: | ||
[<pkg>] Package to scan for autoquery comments. | ||
Flags: | ||
-h, --help Show context-sensitive help. | ||
--out-dir=STRING Destination directory for the sql files. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hermit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hermit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hermit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Hermit environment | ||
|
||
This is a [Hermit](https://github.com/cashapp/hermit) bin directory. | ||
|
||
The symlinks in this directory are managed by Hermit and will automatically | ||
download and install Hermit itself as well as packages. These packages are | ||
local to this environment. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
# This file must be used with "source bin/activate-hermit" from bash or zsh. | ||
# You cannot run it directly | ||
# | ||
# THIS FILE IS GENERATED; DO NOT MODIFY | ||
|
||
if [ "${BASH_SOURCE-}" = "$0" ]; then | ||
echo "You must source this script: \$ source $0" >&2 | ||
exit 33 | ||
fi | ||
|
||
BIN_DIR="$(dirname "${BASH_SOURCE[0]:-${(%):-%x}}")" | ||
if "${BIN_DIR}/hermit" noop > /dev/null; then | ||
eval "$("${BIN_DIR}/hermit" activate "${BIN_DIR}/..")" | ||
|
||
if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ]; then | ||
hash -r 2>/dev/null | ||
fi | ||
|
||
echo "Hermit environment $("${HERMIT_ENV}"/bin/hermit env HERMIT_ENV) activated" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.go@1.22.pkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.go@1.22.pkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.golangci-lint-1.56.1.pkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.goreleaser-1.24.0.pkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
# | ||
# THIS FILE IS GENERATED; DO NOT MODIFY | ||
|
||
set -eo pipefail | ||
|
||
export HERMIT_USER_HOME=~ | ||
|
||
if [ -z "${HERMIT_STATE_DIR}" ]; then | ||
case "$(uname -s)" in | ||
Darwin) | ||
export HERMIT_STATE_DIR="${HERMIT_USER_HOME}/Library/Caches/hermit" | ||
;; | ||
Linux) | ||
export HERMIT_STATE_DIR="${XDG_CACHE_HOME:-${HERMIT_USER_HOME}/.cache}/hermit" | ||
;; | ||
esac | ||
fi | ||
|
||
export HERMIT_DIST_URL="${HERMIT_DIST_URL:-https://github.com/cashapp/hermit/releases/download/stable}" | ||
HERMIT_CHANNEL="$(basename "${HERMIT_DIST_URL}")" | ||
export HERMIT_CHANNEL | ||
export HERMIT_EXE=${HERMIT_EXE:-${HERMIT_STATE_DIR}/pkg/hermit@${HERMIT_CHANNEL}/hermit} | ||
|
||
if [ ! -x "${HERMIT_EXE}" ]; then | ||
echo "Bootstrapping ${HERMIT_EXE} from ${HERMIT_DIST_URL}" 1>&2 | ||
INSTALL_SCRIPT="$(mktemp)" | ||
# This value must match that of the install script | ||
INSTALL_SCRIPT_SHA256="180e997dd837f839a3072a5e2f558619b6d12555cd5452d3ab19d87720704e38" | ||
if [ "${INSTALL_SCRIPT_SHA256}" = "BYPASS" ]; then | ||
curl -fsSL "${HERMIT_DIST_URL}/install.sh" -o "${INSTALL_SCRIPT}" | ||
else | ||
# Install script is versioned by its sha256sum value | ||
curl -fsSL "${HERMIT_DIST_URL}/install-${INSTALL_SCRIPT_SHA256}.sh" -o "${INSTALL_SCRIPT}" | ||
# Verify install script's sha256sum | ||
openssl dgst -sha256 "${INSTALL_SCRIPT}" | \ | ||
awk -v EXPECTED="$INSTALL_SCRIPT_SHA256" \ | ||
'$2!=EXPECTED {print "Install script sha256 " $2 " does not match " EXPECTED; exit 1}' | ||
fi | ||
/bin/bash "${INSTALL_SCRIPT}" 1>&2 | ||
fi | ||
|
||
exec "${HERMIT_EXE}" --level=fatal exec "$0" -- "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
env = { | ||
"PATH": "${HERMIT_ENV}/scripts:${PATH}", | ||
} |
Oops, something went wrong.