Skip to content

Commit

Permalink
Use github.com/caitlinelfring/go-env-default package (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
caitlinelfring authored Jul 11, 2021
1 parent e6c5bed commit 9eb558b
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 67 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/get-woke/woke
go 1.16

require (
github.com/caitlinelfring/go-env-default v1.0.0
github.com/fatih/color v1.12.0
github.com/get-woke/fastwalk v1.0.0
github.com/get-woke/go-gitignore v1.1.2
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84=
github.com/caitlinelfring/go-env-default v1.0.0 h1:DY8qY3OKb9PrGe+sjop7dw7tOKh6kV8cdZONlESSbZc=
github.com/caitlinelfring/go-env-default v1.0.0/go.mod h1:vY8iS64s+wIBKayqiNGJsWMwc19NrxaNNTyWzuPvE44=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
Expand Down
6 changes: 3 additions & 3 deletions pkg/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package parser
import (
"os"
"sort"
"strconv"
"sync"

"github.com/get-woke/woke/pkg/ignore"
Expand All @@ -14,6 +13,7 @@ import (
"github.com/get-woke/woke/pkg/util"
"github.com/get-woke/woke/pkg/walker"

env "github.com/caitlinelfring/go-env-default"
"github.com/rs/zerolog/log"
)

Expand Down Expand Up @@ -103,8 +103,8 @@ func (p *Parser) processFindingInPath(path string, done chan bool) {
files := p.walkDir(path, done)

// run parallel, but bounded
numWorkerStr := util.GetEnvDefault("WORKER_POOL_COUNT", "0")
if numWorker, err := strconv.Atoi(numWorkerStr); err == nil && numWorker > 0 {
numWorker := env.GetIntDefault("WORKER_POOL_COUNT", 0)
if numWorker > 0 {
log.Debug().Str("path", path).Str("type", "bounded").Int("workers", numWorker).Msg("process files")

wg.Add(numWorkers)
Expand Down
4 changes: 2 additions & 2 deletions pkg/printer/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"strings"

"github.com/get-woke/woke/pkg/result"
"github.com/get-woke/woke/pkg/util"

env "github.com/caitlinelfring/go-env-default"
"github.com/rs/zerolog/log"
)

Expand Down Expand Up @@ -45,7 +45,7 @@ func NewPrinter(f string) (Printer, error) {
var p Printer
switch f {
case OutFormatText:
p = NewText(util.GetEnvBoolDefault("DISABLE_COLORS", false))
p = NewText(env.GetBoolDefault("DISABLE_COLORS", false))
case OutFormatSimple:
p = NewSimple()
case OutFormatGitHubActions:
Expand Down
24 changes: 0 additions & 24 deletions pkg/util/env.go

This file was deleted.

38 changes: 0 additions & 38 deletions pkg/util/env_test.go

This file was deleted.

0 comments on commit 9eb558b

Please sign in to comment.