Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
edaniels committed Mar 25, 2022
0 parents commit 5185efb
Show file tree
Hide file tree
Showing 18 changed files with 5,766 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

gcp.json
*~
*.#
*#

# Goland project directory
.idea

# Frontend ignores
**/node_modules

# macOS ignores
*.DS_Store

# gRPC/Protocol Buffers
bin
docs
dist/*

# exclude files from `ag` search
.ignore
72 changes: 72 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
service:
golangci-lint-version: 1.43.x
run:
deadline: 600s
skip-dirs:
- genfiles$
- gen$
- vendor$
- test$
tests: true
linters:
enable-all: true
disable:
- cyclop
- exhaustivestruct
- funlen
- gocognit
- godox
- goerr113
- gochecknoglobals
- gochecknoinits
- gocyclo
- gofmt
- goimports
- golint
- gomnd
- interfacer
- ireturn
- maligned
- makezero
- nestif
- nlreturn
- paralleltest
- prealloc
- scopelint
- tagliatelle
- testpackage
- varnamelen
- wrapcheck
- wsl
linters-settings:
errcheck:
check-blank: true
gosec:
excludes:
- G601
gci:
local-prefixes: go.viam.com/api
govet:
enable-all: true
disable:
- fieldalignment
- shadow
lll:
line-length: 140
issues:
exclude:
- composites
exclude-rules:
- path: _test\.go$|^tests/|^samples/
linters:
- errcheck
- contextcheck
- exhaustive
- forcetypeassert
- goconst
- gosec
- govet
- noctx
exclude-use-default: false
max-per-linter: 0
max-same-issues: 0
32 changes: 32 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
PATH_WITH_TOOLS="`pwd`/bin:`pwd`/frontend/node_modules/.bin:${PATH}"

setup:
bash etc/setup.sh

dist/tool-install: Makefile
GOBIN=`pwd`/bin go install google.golang.org/protobuf/cmd/protoc-gen-go \
github.com/bufbuild/buf/cmd/buf \
github.com/bufbuild/buf/cmd/protoc-gen-buf-breaking \
github.com/bufbuild/buf/cmd/protoc-gen-buf-lint \
github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc \
google.golang.org/grpc/cmd/protoc-gen-go-grpc \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 \
github.com/srikrsna/protoc-gen-gotag \
github.com/edaniels/golinters/cmd/combined \
github.com/golangci/golangci-lint/cmd/golangci-lint
mkdir -p dist
touch dist/tool-install

dist/buf: dist/buf-go

dist/buf-go: dist/tool-install proto/robot/v1/robot.proto proto/tagger/v1/tagger.proto
PATH=$(PATH_WITH_TOOLS) buf lint
PATH=$(PATH_WITH_TOOLS) buf generate
PATH=$(PATH_WITH_TOOLS) buf generate --template ./etc/buf.gen.tag.yaml
touch dist/buf-go

lint: dist/tool-install
PATH=$(PATH_WITH_TOOLS) buf lint
export pkgs=`go list -f '{{.Dir}}' ./... | grep -v gen | grep -v proto` && echo "$$pkgs" | xargs go vet -vettool=bin/combined
export pkgs=`go list -f '{{.Dir}}' ./... | grep -v gen | grep -v proto` && echo "$$pkgs" | xargs go run github.com/golangci/golangci-lint/cmd/golangci-lint run -v --fix --config=./etc/.golangci.yaml
20 changes: 20 additions & 0 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: v1beta1
plugins:
- name: go
out: .
opt:
- paths=source_relative
- name: go-grpc
out: .
opt:
- paths=source_relative
- name: grpc-gateway
out: .
opt:
- paths=source_relative
- generate_unbound_methods=true
- name: doc
out: docs/proto
strategy: all
opt:
- html,index.html
9 changes: 9 additions & 0 deletions buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: v1
build:
excludes: [node_modules]
lint:
use:
- DEFAULT
breaking:
use:
- FILE
77 changes: 77 additions & 0 deletions etc/.golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
service:
golangci-lint-version: 1.43.x
run:
deadline: 600s
skip-dirs:
- genfiles$
- gen$
- vendor$
- test$
tests: true
linters:
enable-all: true
disable:
- cyclop
- exhaustivestruct
- funlen
- gocognit
- godox
- goerr113
- gochecknoglobals
- gochecknoinits
- gocyclo
- gofmt
- goimports
- golint
- gomnd
- interfacer
- ireturn
- maligned
- makezero
- nestif
- nlreturn
- paralleltest
- prealloc
- scopelint
- tagliatelle
- testpackage
- varnamelen
- wrapcheck
- wsl
linters-settings:
errcheck:
check-blank: true
gosec:
excludes:
- G601
gci:
local-prefixes: go.viam.com/api
gomoddirectives:
replace-allow-list:
- github.com/go-acme/lego/v4
- github.com/pion/ice/v2
- github.com/grandcat/zeroconf
govet:
enable-all: true
disable:
- fieldalignment
- shadow
lll:
line-length: 140
issues:
exclude:
- composites
exclude-rules:
- path: _test\.go$|^tests/|^samples/
linters:
- errcheck
- contextcheck
- exhaustive
- forcetypeassert
- goconst
- gosec
- govet
- noctx
exclude-use-default: false
max-per-linter: 0
max-same-issues: 0
6 changes: 6 additions & 0 deletions etc/buf.gen.tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: v1beta1
plugins:
- name: gotag
out: .
opt:
- paths=source_relative
15 changes: 15 additions & 0 deletions etc/buf.web.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: v1beta1
plugins:
- name: js
out: dist/js
opt:
- import_style=commonjs
- name: grpc-web
out: dist/js
opt:
- import_style=commonjs
- mode=grpcwebtext
- name: ts
out: dist/js
opt:
- service=grpc-web
Loading

0 comments on commit 5185efb

Please sign in to comment.