Skip to content

Commit

Permalink
add info command, plugin support, fix minor issues
Browse files Browse the repository at this point in the history
  • Loading branch information
janosmiko committed Feb 3, 2023
1 parent f2aafcd commit 21754dd
Show file tree
Hide file tree
Showing 48 changed files with 2,635 additions and 1,493 deletions.
106 changes: 59 additions & 47 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,56 +10,63 @@ run:
linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
enable:
# https://golangci-lint.run/usage/linters/#enabled-by-default-linters
# ENABLED BY DEFAULT START
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused
# ENABLED BY DEFAULT END
disable:
# BUG
# https://github.com/golangci/golangci-lint/issues/2649
# - bodyclose
# - contextcheck
# - interfacer
# - nilerr
# - noctx
# - rowserrcheck
# - sqlclosecheck
# - structcheck
# - tparallel
# - wastedassign
- bodyclose
- contextcheck
- interfacer
- nilerr
- noctx
- rowserrcheck
- sqlclosecheck
- structcheck
- tparallel
- wastedassign
# BUG END
# DEPRECATED START
# - golint
# - ifshort
# - maligned
# - exhaustivestruct
# - scopelint
# - deadcode
# - varcheck
- deadcode
- exhaustivestruct
- golint
- ifshort
- maligned
- nosnakecase
- scopelint
- varcheck
# DEPRECATED END
# IGNORED START
- gci # sort imports in a so-so way. use goimports instead
- gochecknoglobals # we use some global variables
- goerr113 # not useful
- nonamedreturns # named returns are our friends
- gomnd # false positives for file permissions
- testpackage # using
# IGNORED END
# PANICS START
# - exhaustruct
- exhaustruct
# PANICS END

enable:
# TODO START
# - cyclop
# - funlen
# - gocognit
# - goconst
# - gocyclo
- goconst
- gocyclo
# - godox
# - maintidx
# - nestif
- maintidx
# - nestif
# - paralleltest
# - varnamelen
# - wrapcheck
- varnamelen
- wrapcheck
# TODO END
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused
- asasalint
- asciicheck
- bidichk
Expand All @@ -77,17 +84,13 @@ linters:
- exportloopref
- forbidigo
- forcetypeassert
# - gci
# - gochecknoglobals
# - gochecknoinits
- gochecknoinits
- gocritic
- godot
# - goerr113
# - gofmt
- gofmt
- gofumpt
- goheader
- goimports
# - gomnd
- gomoddirectives
- gomodguard
- goprintffuncname
Expand All @@ -102,17 +105,14 @@ linters:
- nilnil
- nlreturn
- nolintlint
# - nonamedreturns
# - nosnakecase
- nosprintfhostport
# - prealloc
- prealloc
- predeclared
- promlinter
- revive
- stylecheck
- tagliatelle
- tenv
# - testpackage
- thelper
- unconvert
- unparam
Expand All @@ -130,5 +130,17 @@ linters-settings:
min-occurrences: 5
varnamelen:
max-distance: 15
ignore-names:
- tt
- id
ignore-decls:
- t table.Writer
- bs []byte
- bs bytes.Buffer
- i int
- FS *afero.Afero
funlen:
lines: 100
lines: 100
wrapcheck:
ignorePackageGlobs:
- github.com/rewardenv/reward/*
2 changes: 1 addition & 1 deletion .goreleaser.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ builds:
- CGO_ENABLED=0
main: ./cmd/reward
ldflags:
- -s -w -X main.VERSION=v0.4.0-beta2-{{ time "200601021504" }}
- -s -w -X main.VERSION=v0.4.0-beta3-{{ time "200601021504" }}
goos:
- linux
- windows
Expand Down
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,24 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.4.0-beta2] - 2023-02-01
## [0.4.0-beta3] - 2023-02-03

We're super excited to announce `Reward` 0.4.0!

### New Features

- Add `reward info` command to show information about the current Reward configuration
- Add plugin install support
- Add support for `GITHUB_TOKEN` environment variable used for GitHub API requests.

### Improvements

- Fix linting issues, minor bugs, and improve documentation
- Bootstrap functions are revamped to be more modular
- Use GitHub API to self-update and plugin install

## [0.4.0-beta2] - 2023-02-01

### Improvements

- Add new versions for Elasticsearch, OpenSearch, MariaDB, Redis
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,8 @@ gomod: ## Update Go Dependencies
lint: ## Lint Go Code
golangci-lint run ./...

lint-fix: ## Lint Go Code
golangci-lint run --fix ./...

test: ## Run Go tests
go test -race -v ./...
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.4.0-beta2
v0.4.0-beta3
15 changes: 8 additions & 7 deletions cmd/blackfire/blackfire.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ import (
"github.com/rewardenv/reward/internal/logic"
)

func NewBlackfireCmd(c *config.Config) *cmdpkg.Command {
func NewBlackfireCmd(conf *config.Config) *cmdpkg.Command {
return &cmdpkg.Command{
Command: &cobra.Command{
Use: "blackfire [command]",
Short: fmt.Sprintf(
"Interacts with the blackfire service on an environment (disabled if %s_BLACKFIRE is not 1)",
strings.ToUpper(c.AppName()),
strings.ToUpper(conf.AppName()),
),
Long: fmt.Sprintf(
`Interacts with the blackfire service on an environment (disabled if %s_BLACKFIRE is not 1)`,
strings.ToUpper(c.AppName()),
strings.ToUpper(conf.AppName()),
),
ValidArgsFunction: func(
cmd *cobra.Command,
Expand All @@ -32,22 +32,23 @@ func NewBlackfireCmd(c *config.Config) *cmdpkg.Command {
return nil, cobra.ShellCompDirectiveNoFileComp
},
PreRunE: func(cmd *cobra.Command, args []string) error {
if !c.Docker.ContainerRunning(c.BlackfireContainer()) {
return docker.ErrCannotFindContainer(c.BlackfireContainer(),
if !conf.Docker.ContainerRunning(conf.BlackfireContainer()) {
return docker.ErrCannotFindContainer(conf.BlackfireContainer(),
fmt.Errorf("blackfire container not found"))
}

return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
err := logic.New(c).RunCmdBlackfire(&cmdpkg.Command{Command: cmd, Config: c}, args)
err := logic.New(conf).RunCmdBlackfire(&cmdpkg.Command{Command: cmd, Config: conf},
args)
if err != nil {
return fmt.Errorf("error running blackfire command: %w", err)
}

return nil
},
},
Config: c,
Config: conf,
}
}
Loading

0 comments on commit 21754dd

Please sign in to comment.