Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,13 @@ jobs:
with:
go-version: 1.18
- run: go vet ./...
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v2
with:
go-version: 1.18
- uses: golangci/golangci-lint-action@v3.1.0
with:
args: --config .golangci.yml
23 changes: 23 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
linters:
enable:
# Checks for non-ASCII identifiers
- asciicheck
# Computes and checks the cyclomatic complexity of functions.
- gocyclo
# Inspects source code for security problems.
- gosec
linters-settings:
gocyclo:
# Minimal code complexity to report.
# https://github.com/fzipp/gocyclo#readme
min-complexity: 28
gosec:
excludes:
# Ignore the fact that we might set TLS InsecureSkipVerify
- G402
issues:
# Disable max issues per linter.
max-issues-per-linter: 0
# Disable max same issues.
max-same-issues: 0
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/jessevdk/go-flags v1.5.0
github.com/onsi/ginkgo/v2 v2.1.4
github.com/onsi/gomega v1.19.0
golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
)

require (
Expand All @@ -22,8 +22,7 @@ require (
github.com/kr/pretty v0.3.0 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
golang.org/x/sys v0.0.0-20220406163625-3f8b81556e12 // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.10 // indirect
google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83 // indirect
Expand Down
6 changes: 1 addition & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,6 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce h1:Roh6XWxHFKrPgC/EQhVubSAGQ6Ozk6IdxHSzt1mR0EI=
golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -287,7 +285,6 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f h1:oA4XRj0qtSt8Yo1Zms0CUlsT3KG69V2UGQWPBxujDmc=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
Expand Down Expand Up @@ -347,9 +344,8 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 h1:OH54vjqzRWmbJ62fjuhxy7AxFFgoHN0/DPc/UrL8cAs=
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220406163625-3f8b81556e12 h1:QyVthZKMsyaQwBTJE04jdNN0Pp5Fn9Qga0mrgxyERQM=
golang.org/x/sys v0.0.0-20220406163625-3f8b81556e12/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand Down
7 changes: 3 additions & 4 deletions internal/command/tail.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,9 @@ type lineWriter struct {
w io.Writer
}

func (w *lineWriter) Write(line string) error {
func (w *lineWriter) Write(line string) {
line = strings.TrimSuffix(line, "\n") + "\n"
_, err := w.w.Write([]byte(line))
return err
_, _ = w.w.Write([]byte(line))
}

const (
Expand Down Expand Up @@ -356,7 +355,7 @@ func (o tailOptions) validate() error {

_, err := regexp.Compile(o.nameFilter)
if err != nil {
return errors.New(fmt.Sprintf("Invalid name filter '%s'. Ensure your name-filter is a valid regex.", o.nameFilter))
return fmt.Errorf("Invalid name filter '%s'. Ensure your name-filter is a valid regex.", o.nameFilter)
}

return nil
Expand Down
32 changes: 0 additions & 32 deletions internal/command/tail_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1926,38 +1926,6 @@ var eventResponseTemplate = `{
}
}`

var invalidTimestampResponse = `{
"envelopes": {
"batch": [
{
"source_id": "app-name",
"timestamp":"not-a-timestamp",
"instance_id":"0",
"deprecated_tags": {
"source_type":{"text":"APP/PROC/WEB"}
},
"log":{"payload":"bG9nIGJvZHk="}
}
]
}
}`

var invalidPayloadResponse = `{
"envelopes": {
"batch": [
{
"source_id": "app-name",
"timestamp":"0",
"instance_id":"0",
"deprecated_tags": {
"source_type":{"text":"APP/PROC/WEB"}
},
"log":{"payload":"~*&#"}
}
]
}
}`

var mixedResponseTemplate = `{
"envelopes": {
"batch": [
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"code.cloudfoundry.org/cli/plugin"
"code.cloudfoundry.org/log-cache-cli/v4/internal/command"
"golang.org/x/crypto/ssh/terminal"
"golang.org/x/term"
)

// semver version is set via ldflags at compile time
Expand All @@ -20,7 +20,7 @@ var version string
type LogCacheCLI struct{}

func (c *LogCacheCLI) Run(conn plugin.CliConnection, args []string) {
isTerminal := terminal.IsTerminal(int(os.Stdout.Fd()))
isTerminal := term.IsTerminal(int(os.Stdout.Fd()))

skipSSL, err := conn.IsSSLDisabled()
if err != nil {
Expand Down
3 changes: 0 additions & 3 deletions vendor/golang.org/x/crypto/AUTHORS

This file was deleted.

3 changes: 0 additions & 3 deletions vendor/golang.org/x/crypto/CONTRIBUTORS

This file was deleted.

27 changes: 0 additions & 27 deletions vendor/golang.org/x/crypto/LICENSE

This file was deleted.

22 changes: 0 additions & 22 deletions vendor/golang.org/x/crypto/PATENTS

This file was deleted.

76 changes: 0 additions & 76 deletions vendor/golang.org/x/crypto/ssh/terminal/terminal.go

This file was deleted.

1 change: 0 additions & 1 deletion vendor/golang.org/x/sys/unix/mkerrors.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion vendor/golang.org/x/sys/unix/syscall_bsd.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 40 additions & 1 deletion vendor/golang.org/x/sys/unix/syscall_darwin.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions vendor/golang.org/x/sys/unix/syscall_dragonfly.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading