Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: attempt to auto format PRs #2176

Merged
merged 2 commits into from
Jul 26, 2024
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
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
on:
schedule:
# Run daily
- cron: "0 22 * * *"
name: Auto-format
pull_request:
name: Auto-format Pull Request
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
ref: ${{ github.head_ref }}
token: ${{ secrets.FTL_AUTOFMT_TOKEN }}
- name: Init Hermit
run: ./bin/hermit env -r >> "$GITHUB_ENV"
Expand All @@ -20,9 +17,11 @@ jobs:
id: git-check
run: echo "modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)" >> "$GITHUB_OUTPUT"
- name: Push changes
env:
HEAD: ${{ github.head_ref }}
if: steps.git-check.outputs.modified == 'true'
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git commit -am "chore(autofmt): Automated formatting"
git push
git push origin "$HEAD"
1 change: 1 addition & 0 deletions backend/controller/admin/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"net/url"

"connectrpc.com/connect"

ftlv1 "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1"
"github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/ftlv1connect"
)
Expand Down
3 changes: 2 additions & 1 deletion backend/controller/admin/local_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import (
"fmt"
"path/filepath"

"github.com/alecthomas/types/optional"

"github.com/TBD54566975/ftl/backend/schema"
"github.com/TBD54566975/ftl/buildengine"
cf "github.com/TBD54566975/ftl/common/configuration"
"github.com/TBD54566975/ftl/common/projectconfig"
"github.com/alecthomas/types/optional"
)

// localClient reads and writes to local projectconfig files without making any network
Expand Down
3 changes: 1 addition & 2 deletions backend/controller/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import (
"fmt"
"time"

"github.com/reugn/go-quartz/logger"

"connectrpc.com/connect"
"github.com/alecthomas/types/optional"
"github.com/reugn/go-quartz/logger"
"google.golang.org/protobuf/types/known/durationpb"
"google.golang.org/protobuf/types/known/timestamppb"

Expand Down
2 changes: 1 addition & 1 deletion backend/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"encoding/binary"
"errors"
"fmt"
"github.com/TBD54566975/ftl/backend/controller/observability"
"hash"
"io"
"math/rand"
Expand Down Expand Up @@ -43,6 +42,7 @@ import (
"github.com/TBD54566975/ftl/backend/controller/dal"
"github.com/TBD54566975/ftl/backend/controller/ingress"
"github.com/TBD54566975/ftl/backend/controller/leases"
"github.com/TBD54566975/ftl/backend/controller/observability"
"github.com/TBD54566975/ftl/backend/controller/pubsub"
"github.com/TBD54566975/ftl/backend/controller/scaling"
"github.com/TBD54566975/ftl/backend/controller/scaling/localscaling"
Expand Down
2 changes: 1 addition & 1 deletion backend/controller/dal/fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/TBD54566975/ftl/backend/controller/observability"
"time"

"github.com/alecthomas/types/optional"

"github.com/TBD54566975/ftl/backend/controller/leases"
"github.com/TBD54566975/ftl/backend/controller/observability"
"github.com/TBD54566975/ftl/backend/controller/sql"
dalerrs "github.com/TBD54566975/ftl/backend/dal"
"github.com/TBD54566975/ftl/backend/schema"
Expand Down
3 changes: 2 additions & 1 deletion backend/controller/ingress/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import (
"strconv"
"strings"

"github.com/alecthomas/types/optional"

"github.com/TBD54566975/ftl/backend/controller/dal"
"github.com/TBD54566975/ftl/backend/schema"
"github.com/alecthomas/types/optional"
)

// BuildRequestBody extracts the HttpRequest body from an HTTP request.
Expand Down
6 changes: 4 additions & 2 deletions backend/controller/observability/fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package observability
import (
"context"
"fmt"
"github.com/TBD54566975/ftl/backend/schema"
"github.com/TBD54566975/ftl/internal/observability"

"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"

"github.com/TBD54566975/ftl/backend/schema"
"github.com/TBD54566975/ftl/internal/observability"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion backend/controller/pubsub/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import (
"context"
"time"

"github.com/jpillora/backoff"

"github.com/TBD54566975/ftl/backend/controller/dal"
"github.com/TBD54566975/ftl/backend/controller/scheduledtask"
"github.com/TBD54566975/ftl/internal/log"
"github.com/jpillora/backoff"
)

const (
Expand Down
1 change: 1 addition & 0 deletions backend/controller/sql/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"

"github.com/jackc/pgx/v5"
)

Expand Down
3 changes: 2 additions & 1 deletion backend/schema/metadatasubscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package schema
import (
"fmt"

schemapb "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/schema"
"google.golang.org/protobuf/proto"

schemapb "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/schema"
)

type MetadataSubscriber struct {
Expand Down
3 changes: 2 additions & 1 deletion backend/schema/metadatatypemap.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package schema
import (
"fmt"

schemapb "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/schema"
"google.golang.org/protobuf/reflect/protoreflect"

schemapb "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/schema"
)

type MetadataTypeMap struct {
Expand Down
3 changes: 2 additions & 1 deletion backend/schema/topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"fmt"
"strings"

schemapb "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/schema"
"google.golang.org/protobuf/proto"

schemapb "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/schema"
)

type Topic struct {
Expand Down
3 changes: 1 addition & 2 deletions buildengine/build_kotlin.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ import (
"sort"
"strings"

"github.com/TBD54566975/scaffolder"
"github.com/beevik/etree"
sets "github.com/deckarep/golang-set/v2"
"golang.org/x/exp/maps"

"github.com/TBD54566975/scaffolder"

"github.com/TBD54566975/ftl"
"github.com/TBD54566975/ftl/backend/schema"
"github.com/TBD54566975/ftl/internal"
Expand Down
1 change: 1 addition & 0 deletions buildengine/build_rust.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package buildengine
import (
"context"
"fmt"

"github.com/TBD54566975/ftl/backend/schema"
"github.com/TBD54566975/ftl/internal/exec"
"github.com/TBD54566975/ftl/internal/log"
Expand Down
1 change: 0 additions & 1 deletion cmd/ftl/cmd_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"os"

"connectrpc.com/connect"

"github.com/alecthomas/types/optional"

"github.com/TBD54566975/ftl/backend/controller/admin"
Expand Down
3 changes: 1 addition & 2 deletions cmd/ftl/cmd_dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import (
"fmt"
"time"

"golang.org/x/sync/errgroup"

"github.com/alecthomas/types/optional"
"golang.org/x/sync/errgroup"

"github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/ftlv1connect"
"github.com/TBD54566975/ftl/buildengine"
Expand Down
2 changes: 1 addition & 1 deletion cmd/ftl/cmd_schema_diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"

"connectrpc.com/connect"
"github.com/alecthomas/chroma/v2/quick"
"github.com/hexops/gotextdiff"
"github.com/hexops/gotextdiff/myers"
"github.com/hexops/gotextdiff/span"
Expand All @@ -18,7 +19,6 @@ import (
"github.com/TBD54566975/ftl/backend/schema"
"github.com/TBD54566975/ftl/internal/log"
"github.com/TBD54566975/ftl/internal/rpc"
"github.com/alecthomas/chroma/v2/quick"
)

type schemaDiffCmd struct {
Expand Down
1 change: 0 additions & 1 deletion cmd/ftl/cmd_secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"os"

"connectrpc.com/connect"

"github.com/alecthomas/types/optional"
"github.com/mattn/go-isatty"
"golang.org/x/term"
Expand Down
1 change: 0 additions & 1 deletion cmd/ftl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (

"github.com/TBD54566975/ftl"
"github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/ftlv1connect"

"github.com/TBD54566975/ftl/common/projectconfig"
_ "github.com/TBD54566975/ftl/internal/automaxprocs" // Set GOMAXPROCS to match Linux container CPU quota.
"github.com/TBD54566975/ftl/internal/log"
Expand Down
5 changes: 2 additions & 3 deletions common/configuration/asm.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ import (
"net/url"
"time"

"github.com/TBD54566975/ftl/internal/rpc"
"github.com/alecthomas/types/optional"
"github.com/aws/aws-sdk-go-v2/service/secretsmanager"
"github.com/puzpuzpuz/xsync/v3"

"github.com/TBD54566975/ftl/backend/controller/leader"
"github.com/TBD54566975/ftl/backend/controller/leases"
"github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/ftlv1connect"
"github.com/TBD54566975/ftl/internal/log"

"github.com/aws/aws-sdk-go-v2/service/secretsmanager"
"github.com/TBD54566975/ftl/internal/rpc"
)

type asmClient interface {
Expand Down
2 changes: 1 addition & 1 deletion common/configuration/asm_follower.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"net/url"
"time"

"connectrpc.com/connect"
"github.com/puzpuzpuz/xsync/v3"

"connectrpc.com/connect"
ftlv1 "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1"
"github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/ftlv1connect"
)
Expand Down
6 changes: 3 additions & 3 deletions common/configuration/asm_leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import (
"net/url"
"time"

"github.com/puzpuzpuz/xsync/v3"

"github.com/TBD54566975/ftl/internal/slices"
"github.com/alecthomas/types/optional"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/secretsmanager"
"github.com/aws/aws-sdk-go-v2/service/secretsmanager/types"
"github.com/aws/smithy-go"
"github.com/puzpuzpuz/xsync/v3"

"github.com/TBD54566975/ftl/internal/slices"
)

const asmLeaderSyncInterval = time.Minute * 5
Expand Down
5 changes: 3 additions & 2 deletions common/configuration/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import (
"sync"
"time"

"github.com/TBD54566975/ftl/internal/log"
"github.com/TBD54566975/ftl/internal/slices"
"github.com/alecthomas/types/optional"
"github.com/alecthomas/types/pubsub"
"github.com/puzpuzpuz/xsync/v3"

"github.com/TBD54566975/ftl/internal/log"
"github.com/TBD54566975/ftl/internal/slices"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion common/configuration/db_secret_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"fmt"
"net/url"

"github.com/TBD54566975/ftl/common/configuration/dal"
"github.com/alecthomas/types/optional"

"github.com/TBD54566975/ftl/common/configuration/dal"
)

// DBSecretResolver loads values a project's secrets from the given database.
Expand Down
1 change: 0 additions & 1 deletion common/configuration/manual_sync_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"time"

"github.com/alecthomas/atomic"

"github.com/alecthomas/types/optional"
"github.com/puzpuzpuz/xsync/v3"
)
Expand Down
3 changes: 1 addition & 2 deletions go-runtime/compile/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"strings"
"unicode"

"github.com/TBD54566975/scaffolder"
"github.com/alecthomas/types/optional"
sets "github.com/deckarep/golang-set/v2"
"golang.org/x/exp/maps"
Expand All @@ -22,8 +23,6 @@ import (
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/TBD54566975/scaffolder"

"github.com/TBD54566975/ftl"
schemapb "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/schema"
"github.com/TBD54566975/ftl/backend/schema"
Expand Down
3 changes: 2 additions & 1 deletion go-runtime/ftl/ftltest/fake.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import (
"reflect"
"strings"

"github.com/alecthomas/types/optional"

"github.com/TBD54566975/ftl/backend/schema"
"github.com/TBD54566975/ftl/common/configuration"
"github.com/TBD54566975/ftl/go-runtime/ftl"
"github.com/TBD54566975/ftl/go-runtime/internal"
"github.com/alecthomas/types/optional"
)

// pubSubEvent is a sum type for all events that can be published to the pubsub system.
Expand Down
5 changes: 3 additions & 2 deletions go-runtime/ftl/ftltest/pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ import (
"sync"
"time"

"github.com/alecthomas/types/optional"
"github.com/alecthomas/types/pubsub"

"github.com/TBD54566975/ftl/backend/schema"
"github.com/TBD54566975/ftl/go-runtime/ftl"
"github.com/TBD54566975/ftl/internal/log"
"github.com/TBD54566975/ftl/internal/slices"
"github.com/alecthomas/types/optional"
"github.com/alecthomas/types/pubsub"
)

type fakePubSub struct {
Expand Down
2 changes: 1 addition & 1 deletion go-runtime/ftl/leases.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"time"

"connectrpc.com/connect"
"github.com/alecthomas/types/optional"
"google.golang.org/protobuf/types/known/durationpb"

ftlv1 "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1"
Expand All @@ -18,7 +19,6 @@ import (
"github.com/TBD54566975/ftl/internal/log"
"github.com/TBD54566975/ftl/internal/modulecontext"
"github.com/TBD54566975/ftl/internal/rpc"
"github.com/alecthomas/types/optional"
)

// ErrLeaseHeld is returned when an attempt is made to acquire a lease that is
Expand Down
Loading
Loading