Skip to content

Commit

Permalink
chore: reorder imports (#2378)
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Poignant <[email protected]>
  • Loading branch information
thomaspoignant committed Sep 20, 2024
1 parent 7e20e6a commit 6456671
Show file tree
Hide file tree
Showing 130 changed files with 276 additions and 263 deletions.
5 changes: 5 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ linters:
- unconvert
- unparam
- whitespace
- gofmt
- gci
# - gofumpt
linters-settings:
funlen:
Expand All @@ -37,6 +39,9 @@ linters-settings:
checks: ["all","-S1023"]
gofumpt:
module-path: github.com/thomaspoignant/go-feature-flag
gci:
skip-generated: true
no-lex-order: true
issues:
exclude-dirs:
- (^|/)bin($|/)
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ repos:
rev: v1.59.0
hooks:
- id: golangci-lint
entry: golangci-lint run --enable-only=gci --fix

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.11.0
Expand Down
1 change: 1 addition & 0 deletions cmd/editor/lamda_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"context"

"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
echoadapter "github.com/awslabs/aws-lambda-go-api-proxy/echo"
Expand Down
4 changes: 2 additions & 2 deletions cmd/editor/main.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package main

import (
echoadapter "github.com/awslabs/aws-lambda-go-api-proxy/echo"
"github.com/thomaspoignant/go-feature-flag/model/dto"
"net/http"
"os"

echoadapter "github.com/awslabs/aws-lambda-go-api-proxy/echo"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
custommiddleware "github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/api/middleware"
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/log"
"github.com/thomaspoignant/go-feature-flag/internal/flag"
"github.com/thomaspoignant/go-feature-flag/internal/utils"
"github.com/thomaspoignant/go-feature-flag/model"
"github.com/thomaspoignant/go-feature-flag/model/dto"
)

// This service is an API used to evaluate a flag with an evaluation context
Expand Down
5 changes: 3 additions & 2 deletions cmd/jsonschema-generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import (
"bytes"
"encoding/json"
"fmt"
"log"
"os"

"github.com/invopop/jsonschema"
"github.com/jessevdk/go-flags"
"github.com/thomaspoignant/go-feature-flag/model/dto"
"log"
"os"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/lint/linter.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package main
import (
"encoding/json"
"fmt"
"github.com/thomaspoignant/go-feature-flag/model/dto"
"os"
"strings"

"github.com/BurntSushi/toml"
"github.com/thomaspoignant/go-feature-flag/model/dto"
"k8s.io/apimachinery/pkg/util/yaml"
)

Expand Down
3 changes: 2 additions & 1 deletion cmd/lint/linter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package main

import (
"fmt"
"testing"

"github.com/stretchr/testify/assert"
)
import "testing"

func TestLinter_Lint(t *testing.T) {
tests := []struct {
Expand Down
3 changes: 2 additions & 1 deletion cmd/lint/main_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package main

import (
"github.com/stretchr/testify/assert"
"os"
"os/exec"
"strings"
"testing"

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

func Test_Invalid_input_file(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions cmd/migrationcli/converter/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/thomaspoignant/go-feature-flag/model/dto"
"os"
"strings"

"github.com/BurntSushi/toml"

"github.com/thomaspoignant/go-feature-flag/internal/flag"
"github.com/thomaspoignant/go-feature-flag/model/dto"
"gopkg.in/yaml.v3"
)

Expand Down
2 changes: 0 additions & 2 deletions cmd/migrationcli/converter/converter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import (
"testing"

"github.com/google/go-cmp/cmp"

"github.com/stretchr/testify/assert"

"github.com/thomaspoignant/go-feature-flag/cmd/migrationcli/converter"
)

Expand Down
3 changes: 1 addition & 2 deletions cmd/migrationcli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import (
"log"
"os"

"github.com/thomaspoignant/go-feature-flag/cmd/migrationcli/converter"

"github.com/jessevdk/go-flags"
"github.com/thomaspoignant/go-feature-flag/cmd/migrationcli/converter"
)

func main() {
Expand Down
3 changes: 2 additions & 1 deletion cmd/migrationcli/main_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package main

import (
"github.com/stretchr/testify/assert"
"io"
"os"
"os/exec"
"strings"
"testing"

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

func Test_OutputResult_stdout(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions cmd/relayproxy/api/lambda_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package api

import (
"context"

"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
echoadapter "github.com/awslabs/aws-lambda-go-api-proxy/echo"
Expand Down
6 changes: 3 additions & 3 deletions cmd/relayproxy/api/middleware/version_test.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package middleware_test

import (
"github.com/labstack/echo/v4"
middleware2 "github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/api/middleware"
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/config"
"net/http"
"net/http/httptest"
"testing"

"github.com/labstack/echo/v4"
"github.com/stretchr/testify/assert"
middleware2 "github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/api/middleware"
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/config"
)

func TestVersion(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions cmd/relayproxy/api/middleware/websocket_authorizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package middleware_test

import (
"fmt"
middleware2 "github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/api/middleware"
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/config"
"net/http"
"net/http/httptest"
"testing"

"github.com/labstack/echo/v4"
"github.com/stretchr/testify/assert"
middleware2 "github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/api/middleware"
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/config"
)

func TestWebsocketAuthorizer(t *testing.T) {
Expand Down
5 changes: 2 additions & 3 deletions cmd/relayproxy/api/middleware/zap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ import (
"net/http/httptest"
"testing"

"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/api/middleware"
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/config"

"github.com/labstack/echo/v4"
"github.com/stretchr/testify/assert"
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/api/middleware"
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/config"
"go.uber.org/zap"
"go.uber.org/zap/zaptest/observer"
)
Expand Down
3 changes: 2 additions & 1 deletion cmd/relayproxy/api/opentelemetry/otel.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ package opentelemetry

import (
"context"
"net/url"

"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/config"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp"
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
"net/url"
)

type OtelService struct {
Expand Down
20 changes: 10 additions & 10 deletions cmd/relayproxy/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package config_test

import (
"fmt"
"github.com/stretchr/testify/require"
"io"
"os"
"testing"

"github.com/spf13/pflag"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/config"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
Expand Down Expand Up @@ -750,35 +750,35 @@ func TestMergeConfig_FromOSEnv(t *testing.T) {
FileFormat: "yaml",
Host: "localhost",
Retrievers: &[]config.RetrieverConf{
config.RetrieverConf{
{
Kind: "http",
URL: "https://raw.githubusercontent.com/thomaspoignant/go-feature-flag/main/examples/retriever_file/flags.goff.yaml",
HTTPHeaders: map[string][]string{
"authorization": []string{
"authorization": {
"test",
},
"token": []string{"token"},
"token": {"token"},
},
},
config.RetrieverConf{
{
Kind: "file",
Path: "examples/retriever_file/flags.goff.yaml",
HTTPHeaders: map[string][]string{
"token": []string{
"token": {
"11213123",
},
"authorization": []string{
"authorization": {
"test1",
},
},
},
config.RetrieverConf{
{
HTTPHeaders: map[string][]string{

"authorization": []string{
"authorization": {
"test1",
},
"x-goff-custom": []string{
"x-goff-custom": {
"custom",
},
},
Expand Down
1 change: 1 addition & 0 deletions cmd/relayproxy/config/retriever.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package config

import (
"fmt"

"github.com/redis/go-redis/v9"
)

Expand Down
8 changes: 4 additions & 4 deletions cmd/relayproxy/controller/all_flags.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package controller

import (
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/config"
"github.com/thomaspoignant/go-feature-flag/internal/flagstate"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"net/http"

"github.com/labstack/echo/v4"
ffclient "github.com/thomaspoignant/go-feature-flag"
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/config"
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/metric"
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/model"
"github.com/thomaspoignant/go-feature-flag/internal/flagstate"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
)

type allFlags struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/relayproxy/controller/all_flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package controller_test

import (
"context"
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/metric"
"io"
"log/slog"
"net/http"
Expand All @@ -17,6 +16,7 @@ import (
"github.com/stretchr/testify/assert"
ffclient "github.com/thomaspoignant/go-feature-flag"
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/controller"
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/metric"
"github.com/thomaspoignant/go-feature-flag/exporter/logsexporter"
"github.com/thomaspoignant/go-feature-flag/retriever/fileretriever"
)
Expand Down
3 changes: 2 additions & 1 deletion cmd/relayproxy/controller/collect_eval_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ package controller

import (
"fmt"
"net/http"

"github.com/labstack/echo/v4"
ffclient "github.com/thomaspoignant/go-feature-flag"
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/config"
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/metric"
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/model"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"net/http"
)

type collectEvalData struct {
Expand Down
3 changes: 2 additions & 1 deletion cmd/relayproxy/controller/flag_change.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package controller

import (
"encoding/json"
"net/http"

"github.com/labstack/echo/v4"
ffclient "github.com/thomaspoignant/go-feature-flag"
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/metric"
"github.com/thomaspoignant/go-feature-flag/internal/utils"
http "net/http"
)

type FlagChangeAPICtrl struct {
Expand Down
11 changes: 6 additions & 5 deletions cmd/relayproxy/controller/flag_change_test.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
package controller_test

import (
"net/http"
"net/http/httptest"
"os"
"testing"
"time"

"github.com/labstack/echo/v4"
"github.com/stretchr/testify/assert"
ffclient "github.com/thomaspoignant/go-feature-flag"
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/controller"
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/metric"
"github.com/thomaspoignant/go-feature-flag/retriever/fileretriever"
"golang.org/x/net/context"
"net/http"
"net/http/httptest"
"os"
"testing"
"time"
)

func TestPIFlagChange_WithConfigChange(t *testing.T) {
Expand Down
Loading

0 comments on commit 6456671

Please sign in to comment.