Skip to content

Commit 48f468c

Browse files
authored
chore: migrated private client to be open sourced 🎉 (#1)
* chore: migrated private client to be open sourced 🎉
1 parent 424be69 commit 48f468c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+6238
-6
lines changed

‎.copywrite.hcl

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
schema_version = 1
2+
3+
project {
4+
license = "MIT"
5+
copyright_year = 2023
6+
copyright_holder = "Omlox Client Go Contributors"
7+
8+
# (OPTIONAL) A list of globs that should not have copyright/license headers.
9+
# Supports doublestar glob patterns for more flexibility in defining which
10+
# files or folders should be ignored
11+
header_ignore = [
12+
"**.yaml",
13+
"**.yml",
14+
# "vendor/**",
15+
# "**autogen**",
16+
]
17+
}

‎.envrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then
2+
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8="
3+
fi
4+
use flake

‎.github/workflows/ci.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["**"]
8+
9+
permissions:
10+
contents: "read"
11+
12+
jobs:
13+
check-code-regeneration:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
17+
18+
- name: Set up go
19+
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
20+
with:
21+
go-version: 1.21
22+
23+
- name: Ensure the code has been properly regenerated with 'make regen'
24+
run: |
25+
go generate ./...
26+
readonly changed_files="$(git diff --stat)"
27+
if [[ "${changed_files}" != "" ]]; then
28+
echo "Found differences after running 'go generate ./...'"
29+
echo "Please run 'go generate ./...' & commit the changed files:"
30+
echo "${changed_files}"
31+
exit 1
32+
fi
33+
34+
tests:
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
38+
39+
- name: Set up go
40+
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
41+
with:
42+
go-version: 1.21
43+
44+
- name: Build
45+
run: go build -v ./...
46+
47+
- name: Test
48+
run: go test -v ./...
49+
50+
# TODO @dvcorreia: add linting workflow

‎.github/workflows/release.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
permissions:
9+
contents: write
10+
packages: "write"
11+
12+
jobs:
13+
check-copywrite:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
17+
18+
- name: Setup Copywrite
19+
uses: hashicorp/setup-copywrite@3ace06ad72e6ec679ea8572457b17dbc3960b8ce # v1.0.0
20+
21+
- name: Check Header Compliance
22+
run: copywrite headers
23+
24+
- name: Ensure the code has been properly regenerated with 'make regen'
25+
run: |
26+
make regen
27+
readonly changed_files="$(git diff --stat)"
28+
if [[ "${changed_files}" != "" ]]; then
29+
echo "Found differences in copywrite headers after running 'copywrite headers'"
30+
echo "Please run 'copywrite headers' & commit the changed files:"
31+
echo "${changed_files}"
32+
exit 1
33+
fi
34+
35+
goreleaser:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
39+
with:
40+
fetch-depth: 0
41+
- run: git fetch --force --tags
42+
43+
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
44+
with:
45+
go-version: 1.21
46+
47+
- uses: goreleaser/goreleaser-action@v5
48+
with:
49+
distribution: goreleaser
50+
version: latest
51+
args: release --clean
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎.gitignore

+20-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
# If you prefer the allow list template instead of the deny list, see community template:
2-
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
3-
#
1+
# Project specific
2+
build/
3+
bin/
4+
.env
5+
6+
# Direnv
7+
/.direnv/
8+
9+
# Completion debug files
10+
completion.txt
11+
412
# Binaries for programs and plugins
513
*.exe
614
*.exe~
@@ -15,7 +23,13 @@
1523
*.out
1624

1725
# Dependency directories (remove the comment below to include it)
18-
# vendor/
26+
vendor
27+
build
28+
29+
# OS specific
30+
.DS_Store
31+
32+
# IDEs
33+
.vscode
1934

20-
# Go workspace file
21-
go.work
35+
dist/

‎.golangci.yml

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
run:
2+
# default concurrency is a available CPU number
3+
concurrency: 4
4+
# timeout for analysis, e.g. 30s, 5m, default is 1m
5+
timeout: 5m
6+
# exit code when at least one issue was found, default is 1
7+
issues-exit-code: 1
8+
# which dirs to skip: issues from them won't be reported;
9+
# can use regexp here: generated.*, regexp is applied on full path;
10+
# default value is empty list, but default dirs are skipped independently
11+
# from this option's value (see skip-dirs-use-default).
12+
# "/" will be replaced by current OS file path separator to properly work
13+
# on Windows.
14+
skip-dirs:
15+
- build$
16+
- tools$
17+
- scripts$
18+
19+
linters-settings:
20+
gosec:
21+
# To specify a set of rules to explicitly exclude.
22+
# Available rules: https://github.com/securego/gosec#available-rules
23+
excludes:
24+
- G104
25+
- G107
26+
- G404
27+
- G601
28+
gosimple:
29+
go: "1.19"
30+
lll:
31+
line-length: 140
32+
33+
linters:
34+
disable-all: true
35+
enable:
36+
- bodyclose
37+
- depguard
38+
- dogsled
39+
- dupl
40+
- errcheck
41+
- exportloopref
42+
- gochecknoinits
43+
- goconst
44+
- gocritic
45+
- gocyclo
46+
- gofmt
47+
- goimports
48+
- gomnd
49+
- goprintffuncname
50+
- gosec
51+
- gosimple
52+
- govet
53+
- ineffassign
54+
- lll
55+
- misspell
56+
- nakedret
57+
- noctx
58+
- nolintlint
59+
- staticcheck
60+
- stylecheck
61+
- typecheck
62+
- unconvert
63+
- unparam
64+
- unused
65+
- whitespace
66+
67+
# don't enable:
68+
# - asciicheck
69+
# - scopelint
70+
# - gochecknoglobals
71+
# - gocognit
72+
# - godot
73+
# - godox
74+
# - goerr113
75+
# - interfacer
76+
# - maligned
77+
# - nestif
78+
# - prealloc
79+
# - testpackage
80+
# - revive
81+
# - wsl
82+
83+
issues:
84+
# Excluding configuration per-path, per-linter, per-text and per-source
85+
exclude-rules:
86+
# Exclude some linters from running on tests files.
87+
- path: _test\.go
88+
linters:
89+
- gosec
90+
- noctx

‎.goreleaser.yaml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
project_name: omloxctl
2+
3+
git:
4+
tag_sort: "-version:creatordate"
5+
prerelease_suffix: "-"
6+
7+
builds:
8+
- main: ./cmd/omlox
9+
env:
10+
- CGO_ENABLED=0
11+
goos:
12+
- "linux"
13+
- "windows"
14+
- "darwin"
15+
goarch:
16+
- "amd64"
17+
- "arm64"
18+
mod_timestamp: "{{ .CommitTimestamp }}"
19+
flags:
20+
- -trimpath
21+
ldflags:
22+
- "-s -w"
23+
- "-X main.version={{.Version}} -X main.commitHash={{.Commit}} -X main.buildDate={{.Date}}"
24+
25+
archives:
26+
- format: tar.gz
27+
# this name template makes the OS and Arch compatible with the results of `uname`.
28+
name_template: >-
29+
{{ .ProjectName }}_
30+
{{- title .Os }}_
31+
{{- if eq .Arch "amd64" }}x86_64
32+
{{- else if eq .Arch "386" }}i386
33+
{{- else }}{{ .Arch }}{{ end }}
34+
{{- if .Arm }}v{{ .Arm }}{{ end }}
35+
# use zip for windows archives
36+
format_overrides:
37+
- goos: windows
38+
format: zip
39+
40+
checksum:
41+
name_template: "checksums.txt"
42+
snapshot:
43+
name_template: "{{ incpatch .Version }}-nightly"
44+
changelog:
45+
use: "github-native"
46+
sort: "asc"
47+
filters:
48+
exclude:
49+
- "^docs:"
50+
release:
51+
draft: false
52+
prerelease: "auto"
53+
mode: "replace"

‎CODE_OF_CONDUCT.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Contributor Code of Conduct
2+
3+
As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4+
5+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.
6+
7+
Examples of unacceptable behavior by participants include:
8+
9+
* The use of sexualized language or imagery
10+
* Personal attacks
11+
* Trolling or insulting/derogatory comments
12+
* Public or private harassment
13+
* Publishing other's private information, such as physical or electronic addresses, without explicit permission
14+
* Other unethical or unprofessional conduct
15+
16+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.
17+
18+
This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
19+
20+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
21+
22+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 1.2.0, available at https://www.contributor-covenant.org/version/1/2/0/code-of-conduct.html

‎MAINTAINERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Diogo Correia <[email protected], [email protected]> (@dvcorreia)

0 commit comments

Comments
 (0)