Compare commits
2 commits
ec1b22bb49
...
3d8f2d194e
Author | SHA1 | Date | |
---|---|---|---|
3d8f2d194e | |||
badc3eb61e |
4 changed files with 59 additions and 7 deletions
13
.drone.yml
Normal file
13
.drone.yml
Normal file
|
@ -0,0 +1,13 @@
|
|||
kind: pipeline
|
||||
name: default
|
||||
type: docker
|
||||
|
||||
steps:
|
||||
- name: lint
|
||||
image: golangci/golangci-lint:latest
|
||||
commands:
|
||||
- golangci-lint run
|
||||
- name: test
|
||||
image: golangci/golangci-lint:latest
|
||||
commands:
|
||||
- go test -v ./...
|
30
.golangci.yaml
Normal file
30
.golangci.yaml
Normal file
|
@ -0,0 +1,30 @@
|
|||
run:
|
||||
modules-download-mode: readonly
|
||||
|
||||
linters:
|
||||
presets:
|
||||
- bugs
|
||||
- unused
|
||||
- import
|
||||
- module
|
||||
|
||||
enable:
|
||||
- gofumpt
|
||||
- godot
|
||||
- lll
|
||||
- predeclared
|
||||
- gocognit
|
||||
- nestif
|
||||
|
||||
disable:
|
||||
- scopelint
|
||||
|
||||
linters-settings:
|
||||
godot:
|
||||
capital: true
|
||||
lll:
|
||||
line-length: 88
|
||||
gocognit:
|
||||
min-complexity: 10
|
||||
nestif:
|
||||
min-complexity: 3
|
7
.pre-commit-config.yaml
Normal file
7
.pre-commit-config.yaml
Normal file
|
@ -0,0 +1,7 @@
|
|||
repos:
|
||||
- repo: https://github.com/tekwizely/pre-commit-golang
|
||||
rev: v1.0.0-beta.4
|
||||
hooks:
|
||||
- id: golangci-lint-repo-mod
|
||||
name: GolangCI Lint
|
||||
- id: go-test-repo-mod
|
16
ci_ingo.go
16
ci_ingo.go
|
@ -5,7 +5,7 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
// CI holds information about the current CI environment
|
||||
// CI holds information about the current CI environment.
|
||||
type CI struct {
|
||||
Name string
|
||||
Constant string
|
||||
|
@ -25,7 +25,7 @@ type envMatcher interface {
|
|||
matchEnv(env map[string]string) bool
|
||||
}
|
||||
|
||||
// simpleEnvMatcher Test if the specified environment variable is set
|
||||
// simpleEnvMatcher Test if the specified environment variable is set.
|
||||
type simpleEnvMatcher struct {
|
||||
envvar string
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ func (m simpleEnvMatcher) matchEnv(env map[string]string) bool {
|
|||
return exists
|
||||
}
|
||||
|
||||
// anyEnvMatcher Test if any of the specified environment variables is set
|
||||
// anyEnvMatcher Test if any of the specified environment variables is set.
|
||||
type anyEnvMatcher struct {
|
||||
envvars []string
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ func (m anyEnvMatcher) matchEnv(env map[string]string) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
// allEnvMatcher Test if all of the specified environment variables are set
|
||||
// allEnvMatcher Test if all of the specified environment variables are set.
|
||||
type allEnvMatcher struct {
|
||||
envvars []string
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ func (m allEnvMatcher) matchEnv(env map[string]string) bool {
|
|||
}
|
||||
|
||||
// kvEnvMatcher Test if all specified environment variables are set to the
|
||||
// specified values
|
||||
// specified values.
|
||||
type kvEnvMatcher struct {
|
||||
envvars map[string]string
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ func (m kvEnvMatcher) matchEnv(env map[string]string) bool {
|
|||
}
|
||||
|
||||
// neEnvMatcher Test if the specified environment variable is set, but not
|
||||
// to the specified value
|
||||
// to the specified value.
|
||||
type neEnvMatcher struct {
|
||||
envvar string
|
||||
ne string
|
||||
|
@ -93,7 +93,9 @@ func (m neEnvMatcher) matchEnv(env map[string]string) bool {
|
|||
}
|
||||
|
||||
func getEnvironment() map[string]string {
|
||||
getenvironment := func(data []string, getkeyval func(item string) (key, val string)) map[string]string {
|
||||
getenvironment := func(
|
||||
data []string, getkeyval func(item string) (key, val string)) map[string]string {
|
||||
|
||||
items := make(map[string]string)
|
||||
for _, item := range data {
|
||||
key, val := getkeyval(item)
|
||||
|
|
Loading…
Reference in a new issue