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
15 changes: 9 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -702,13 +702,16 @@ lint-go:
golangci-lint run -c .golangci.yml --build-tags='$(LIBFIDO2_TEST_TAG) $(TOUCHID_TAG) $(PIV_TEST_TAG)' $(GO_LINT_FLAGS)

.PHONY: fix-imports
Comment thread
codingllama marked this conversation as resolved.
fix-imports: GOLANG_LINT_ARGS = --build-tags='$(LIBFIDO2_TEST_TAG) $(TOUCHID_TAG) $(PIV_TEST_TAG)' --fix
fix-imports:
golangci-lint run -c .golangci.yml $(GOLANG_LINT_ARGS)
cd api/ && golangci-lint run -c ../.golangci.yml $(GOLANG_LINT_ARGS)
cd build.assets/tooling && golangci-lint run -c ../../.golangci.yml $(GOLANG_LINT_ARGS)
cd .cloudbuild/scripts && golangci-lint run -c ../../.golangci.yml $(GOLANG_LINT_ARGS)
cd assets/backport && golangci-lint run -c ../../.golangci.yml $(GOLANG_LINT_ARGS)
make -C build.assets/ fix-imports

.PHONY: fix-imports/host
fix-imports/host:
@if ! type gci >/dev/null 2>&1; then\
echo 'gci is not installed or is missing from PATH, consider installing it ("go install github.com/daixiang0/gci@latest") or use "make -C build.assets/ fix-imports"';\
exit 1;\
fi
gci write -s 'standard,default,prefix(github.com/gravitational/teleport)' --skip-generated .
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I didn't realize gci write . worked.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

**/*.go doesn't work in Makefile as this pattern goes only one level deep (the same as */*.go) It's super confusing as gci runs without an error but doesn't do much.


.PHONY: lint-build-tooling
lint-build-tooling: GO_LINT_FLAGS ?=
Expand Down
3 changes: 3 additions & 0 deletions build.assets/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ RUN go install github.com/google/addlicense@v1.0.0
# Install golangci-lint.
RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.1

# Install GCI
RUN go install github.com/daixiang0/gci@v0.8.2

# Install helm.
RUN (mkdir -p helm-tarball && curl -L https://get.helm.sh/helm-v3.5.2-$(go env GOOS)-$(go env GOARCH).tar.gz | tar -C helm-tarball -xz && \
cp helm-tarball/$(go env GOOS)-$(go env GOARCH)/helm /bin/ && \
Expand Down
7 changes: 7 additions & 0 deletions build.assets/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,13 @@ grpc-teleterm: buildbox-teleterm
$(DOCKERFLAGS) -e CLANG_FORMAT=/usr/bin/clang-format-10 -t $(BUILDBOX_TELETERM) \
make -C /go/src/github.com/gravitational/teleport grpc-teleterm/host

# fix-imports runs GCI to sort and re-order Go imports in a deterministic way.
.PHONY: fix-imports
fix-imports: buildbox
docker run \
$(DOCKERFLAGS) -t $(BUILDBOX) \
make -C /go/src/github.com/gravitational/teleport fix-imports/host

#
# Removes the docker image
#
Expand Down
4 changes: 2 additions & 2 deletions examples/go-client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import (
"fmt"
"log"

"github.com/google/uuid"
Comment thread
codingllama marked this conversation as resolved.

"github.com/gravitational/teleport/api/client"
"github.com/gravitational/teleport/api/types"

"github.com/google/uuid"
)

func main() {
Expand Down
6 changes: 3 additions & 3 deletions examples/workflows/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ import (
"fmt"
"log"

"github.com/gravitational/trace"
"github.com/pelletier/go-toml"

"github.com/gravitational/teleport/api/client"
"github.com/gravitational/teleport/api/types"
"github.com/gravitational/teleport/api/utils"

"github.com/gravitational/trace"
"github.com/pelletier/go-toml"
)

type config struct {
Expand Down
4 changes: 2 additions & 2 deletions lib/auth/state_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ package auth
import (
"context"

"github.com/gravitational/teleport/lib/backend/memory"

"github.com/gravitational/trace"

"github.com/gravitational/teleport/lib/backend/memory"
)

// NewProcessStorage returns a new instance of the process storage.
Expand Down
1 change: 0 additions & 1 deletion lib/auth/touchid/api_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import (

"github.com/google/uuid"
"github.com/gravitational/trace"

log "github.com/sirupsen/logrus"
)

Expand Down
3 changes: 2 additions & 1 deletion lib/auth/webauthnwin/webauthn_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ import (
"unsafe"

"github.com/duo-labs/webauthn/protocol"
wanlib "github.com/gravitational/teleport/lib/auth/webauthn"
"github.com/gravitational/trace"
log "github.com/sirupsen/logrus"
"golang.org/x/sys/windows"

wanlib "github.com/gravitational/teleport/lib/auth/webauthn"
)

var (
Expand Down
3 changes: 1 addition & 2 deletions lib/backend/dynamo/configure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ import (
"fmt"
"testing"

"github.com/gravitational/trace"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/applicationautoscaling"
"github.com/aws/aws-sdk-go/service/dynamodb"
"github.com/google/uuid"
"github.com/gravitational/trace"
"github.com/stretchr/testify/require"
)

Expand Down
6 changes: 3 additions & 3 deletions lib/bpf/bpf.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ import (
"time"
"unsafe"

"github.com/gravitational/trace"
"github.com/gravitational/ttlmap"

"github.com/gravitational/teleport/api/constants"
apievents "github.com/gravitational/teleport/api/types/events"
controlgroup "github.com/gravitational/teleport/lib/cgroup"
"github.com/gravitational/teleport/lib/events"

"github.com/gravitational/trace"
"github.com/gravitational/ttlmap"
)

//go:embed bytecode
Expand Down
10 changes: 5 additions & 5 deletions lib/bpf/bpf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ import (
"time"
"unsafe"

"github.com/gravitational/teleport/api/constants"
apidefaults "github.com/gravitational/teleport/api/defaults"
apievents "github.com/gravitational/teleport/api/types/events"
"github.com/gravitational/teleport/lib/events/eventstest"

"github.com/aquasecurity/libbpfgo"
"github.com/google/uuid"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/testutil"
"github.com/stretchr/testify/require"

"github.com/gravitational/teleport/api/constants"
apidefaults "github.com/gravitational/teleport/api/defaults"
apievents "github.com/gravitational/teleport/api/types/events"
"github.com/gravitational/teleport/lib/events/eventstest"
)

func TestRootWatch(t *testing.T) {
Expand Down
9 changes: 4 additions & 5 deletions lib/bpf/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@ limitations under the License.
package bpf

import (
"github.com/gravitational/trace"

"github.com/gravitational/teleport"
"github.com/gravitational/teleport/lib/observability/metrics"
_ "embed"

"github.com/aquasecurity/libbpfgo"
"github.com/gravitational/trace"
"github.com/prometheus/client_golang/prometheus"

_ "embed"
"github.com/gravitational/teleport"
"github.com/gravitational/teleport/lib/observability/metrics"
)

var (
Expand Down
9 changes: 4 additions & 5 deletions lib/bpf/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@ limitations under the License.
package bpf

import (
"github.com/gravitational/trace"

"github.com/gravitational/teleport"
"github.com/gravitational/teleport/lib/observability/metrics"
_ "embed"

"github.com/aquasecurity/libbpfgo"
"github.com/gravitational/trace"
"github.com/prometheus/client_golang/prometheus"

_ "embed"
"github.com/gravitational/teleport"
"github.com/gravitational/teleport/lib/observability/metrics"
)

var (
Expand Down
10 changes: 5 additions & 5 deletions lib/bpf/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ limitations under the License.
package bpf

import (
"encoding/binary"
"os"
"sync"
"unsafe"

"github.com/aquasecurity/libbpfgo"
"github.com/gravitational/trace"
"github.com/prometheus/client_golang/prometheus"
"github.com/sirupsen/logrus"

"github.com/gravitational/teleport"

"encoding/binary"
"os"
"sync"
"unsafe"
)

var log = logrus.WithFields(logrus.Fields{
Expand Down
7 changes: 3 additions & 4 deletions lib/bpf/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@ limitations under the License.
package bpf

import (
_ "embed"

"github.com/aquasecurity/libbpfgo"
"github.com/gravitational/trace"
"github.com/prometheus/client_golang/prometheus"

"github.com/gravitational/teleport/lib/observability/metrics"

"github.com/gravitational/teleport"

_ "embed"
"github.com/gravitational/teleport/lib/observability/metrics"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions lib/client/terminal/terminal_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ import (
"syscall"

"github.com/Azure/go-ansiterm/winterm"
"github.com/gravitational/teleport/lib/client/tncon"
"github.com/gravitational/teleport/lib/utils"
"github.com/gravitational/trace"
"github.com/moby/term"

"github.com/gravitational/teleport/lib/client/tncon"
"github.com/gravitational/teleport/lib/utils"
)

// initTerminal configures the terminal for raw, VT compatible output and
Expand Down
4 changes: 2 additions & 2 deletions lib/events/s3sessions/s3handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ import (
"os"
"testing"

"github.com/stretchr/testify/require"

"github.com/gravitational/teleport/lib/events/test"
"github.com/gravitational/teleport/lib/utils"

"github.com/stretchr/testify/require"
)

func TestMain(m *testing.M) {
Expand Down
4 changes: 2 additions & 2 deletions lib/pam/pam.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ import (
"syscall"
"unsafe"

"github.com/gravitational/teleport"
"github.com/gravitational/trace"

"github.com/sirupsen/logrus"

"github.com/gravitational/teleport"
)

func init() {
Expand Down
3 changes: 2 additions & 1 deletion lib/restrictedsession/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ import (
"net"
"unsafe"

"github.com/gravitational/trace"

"github.com/gravitational/teleport/api/types/events"
"github.com/gravitational/teleport/lib/bpf"
api "github.com/gravitational/teleport/lib/events"
"github.com/gravitational/trace"
)

const (
Expand Down
8 changes: 4 additions & 4 deletions lib/restrictedsession/restricted.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ import (
"sync"
"unsafe"

"github.com/gravitational/teleport"
"github.com/gravitational/teleport/lib/bpf"
"github.com/aquasecurity/libbpfgo"
"github.com/gravitational/trace"
"github.com/prometheus/client_golang/prometheus"

"github.com/aquasecurity/libbpfgo"
"github.com/sirupsen/logrus"

"github.com/gravitational/teleport"
"github.com/gravitational/teleport/lib/bpf"
)

var log = logrus.WithFields(logrus.Fields{
Expand Down
8 changes: 4 additions & 4 deletions lib/restrictedsession/restricted_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ import (
"testing"
"time"

go_cmp "github.com/google/go-cmp/cmp"
"github.com/google/uuid"
"github.com/stretchr/testify/require"

apidefaults "github.com/gravitational/teleport/api/defaults"
api "github.com/gravitational/teleport/api/types"
apievents "github.com/gravitational/teleport/api/types/events"
Expand All @@ -38,10 +42,6 @@ import (
"github.com/gravitational/teleport/lib/events/eventstest"
"github.com/gravitational/teleport/lib/services"
"github.com/gravitational/teleport/lib/utils"

go_cmp "github.com/google/go-cmp/cmp"
"github.com/google/uuid"
"github.com/stretchr/testify/require"
)

type blockAction int
Expand Down
4 changes: 2 additions & 2 deletions lib/restrictedsession/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ import (
"sync"
"time"

"github.com/gravitational/trace"

"github.com/gravitational/teleport"
"github.com/gravitational/teleport/api/types"
"github.com/gravitational/teleport/api/utils/retryutils"
"github.com/gravitational/teleport/lib/defaults"
"github.com/gravitational/teleport/lib/utils"

"github.com/gravitational/trace"
)

// NewRestrictionsWatcher returns a new instance of changeset
Expand Down
4 changes: 2 additions & 2 deletions lib/srv/desktop/rdp/rdpclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ import (
"time"
"unsafe"

"github.com/gravitational/teleport/lib/srv/desktop/tdp"
"github.com/gravitational/trace"

"github.com/sirupsen/logrus"

"github.com/gravitational/teleport/lib/srv/desktop/tdp"
)

func init() {
Expand Down
3 changes: 1 addition & 2 deletions lib/utils/agentconn/agent_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ package agentconn
import (
"net"

"github.com/gravitational/trace"

"github.com/Microsoft/go-winio"
"github.com/gravitational/trace"
)

const namedPipe = `\\.\pipe\openssh-ssh-agent`
Expand Down