See how Boundary would look with gofumpt applied (#853)
* See how Boundary would look with https://github.com/mvdan/gofumpt applied Results of running `gofumpt -w -s .` * Update tools file and Makefile for gofumpt Co-authored-by: Jeff Mitchell <jeffrey.mitchell@gmail.com>
This commit is contained in:
1 parent
cca0fbea2b
commit
94cb79bbdd
237 files changed
+1567
-1529
No files matched your search
+1
-3
@@ -14,9 +14,7 @@ import (
|
||||
"github.com/lib/pq"
|
||||
)
|
||||
|
||||
var (
|
||||
StartDbInDocker = docker.StartDbInDocker
|
||||
)
|
||||
var StartDbInDocker = docker.StartDbInDocker
|
||||
|
||||
type DbType int
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ func (u *TestUser) Clone() interface{} {
|
||||
StoreTestUser: s.(*StoreTestUser),
|
||||
}
|
||||
}
|
||||
|
||||
func (u *TestUser) TableName() string {
|
||||
if u.table != "" {
|
||||
return u.table
|
||||
@@ -83,6 +84,7 @@ func (c *TestCar) TableName() string {
|
||||
|
||||
return defaultCarTableName
|
||||
}
|
||||
|
||||
func (c *TestCar) SetTableName(name string) {
|
||||
c.table = name
|
||||
}
|
||||
@@ -103,6 +105,7 @@ func NewTestRental() (*TestRental, error) {
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (r *TestRental) TableName() string {
|
||||
if r.table != "" {
|
||||
return r.table
|
||||
@@ -110,6 +113,7 @@ func (r *TestRental) TableName() string {
|
||||
|
||||
return defaultRentalTableName
|
||||
}
|
||||
|
||||
func (r *TestRental) SetTableName(name string) {
|
||||
r.table = name
|
||||
}
|
||||
@@ -137,6 +141,7 @@ func (t *TestScooter) Clone() interface{} {
|
||||
StoreTestScooter: s.(*StoreTestScooter),
|
||||
}
|
||||
}
|
||||
|
||||
func (t *TestScooter) TableName() string {
|
||||
if t.table != "" {
|
||||
return t.table
|
||||
|
||||
@@ -11,11 +11,12 @@
|
||||
package db_test
|
||||
|
||||
import (
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
|
||||
timestamp "github.com/hashicorp/boundary/internal/db/timestamp"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -555,14 +556,17 @@ func file_controller_storage_db_db_test_v1_db_test_proto_rawDescGZIP() []byte {
|
||||
return file_controller_storage_db_db_test_v1_db_test_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_controller_storage_db_db_test_v1_db_test_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_controller_storage_db_db_test_v1_db_test_proto_goTypes = []interface{}{
|
||||
(*StoreTestUser)(nil), // 0: controller.storage.db.db_test.v1.StoreTestUser
|
||||
(*StoreTestCar)(nil), // 1: controller.storage.db.db_test.v1.StoreTestCar
|
||||
(*StoreTestRental)(nil), // 2: controller.storage.db.db_test.v1.StoreTestRental
|
||||
(*StoreTestScooter)(nil), // 3: controller.storage.db.db_test.v1.StoreTestScooter
|
||||
(*timestamp.Timestamp)(nil), // 4: controller.storage.timestamp.v1.Timestamp
|
||||
}
|
||||
var (
|
||||
file_controller_storage_db_db_test_v1_db_test_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
file_controller_storage_db_db_test_v1_db_test_proto_goTypes = []interface{}{
|
||||
(*StoreTestUser)(nil), // 0: controller.storage.db.db_test.v1.StoreTestUser
|
||||
(*StoreTestCar)(nil), // 1: controller.storage.db.db_test.v1.StoreTestCar
|
||||
(*StoreTestRental)(nil), // 2: controller.storage.db.db_test.v1.StoreTestRental
|
||||
(*StoreTestScooter)(nil), // 3: controller.storage.db.db_test.v1.StoreTestScooter
|
||||
(*timestamp.Timestamp)(nil), // 4: controller.storage.timestamp.v1.Timestamp
|
||||
}
|
||||
)
|
||||
|
||||
var file_controller_storage_db_db_test_v1_db_test_proto_depIdxs = []int32{
|
||||
4, // 0: controller.storage.db.db_test.v1.StoreTestUser.create_time:type_name -> controller.storage.timestamp.v1.Timestamp
|
||||
4, // 1: controller.storage.db.db_test.v1.StoreTestUser.update_time:type_name -> controller.storage.timestamp.v1.Timestamp
|
||||
|
||||
@@ -451,7 +451,7 @@ set id = null;
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 1, count)
|
||||
|
||||
var tests = []struct {
|
||||
tests := []struct {
|
||||
name string
|
||||
stmt string
|
||||
}{
|
||||
@@ -525,7 +525,5 @@ set id = null;
|
||||
assert.Equal(orig.Id, found.Id)
|
||||
assert.Equal(orig.Name, found.Name)
|
||||
assert.Equal(orig.CreateTime, found.CreateTime)
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
@@ -48,7 +48,6 @@ func TestNewPublicId(t *testing.T) {
|
||||
if len(got) != tt.wantLen {
|
||||
t.Errorf("NewPublicId() = %v, with len of %d and wanted len of %v", got, len(got), tt.wantLen)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ func newFakeFile(dialect string, name string) (*fakeFile, error) {
|
||||
ff.dialect = dialect
|
||||
return ff, nil
|
||||
}
|
||||
|
||||
func (f *fakeFile) Read(p []byte) (n int, err error) {
|
||||
return f.reader.Read(p)
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ func generate(dialect string) {
|
||||
}
|
||||
|
||||
outFile := fmt.Sprintf("%s/%s.gen.go", baseDir, dialect)
|
||||
if err := ioutil.WriteFile(outFile, outBuf.Bytes(), 0644); err != nil {
|
||||
if err := ioutil.WriteFile(outFile, outBuf.Bytes(), 0o644); err != nil {
|
||||
fmt.Printf("error writing file %q: %v\n", outFile, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
@@ -169,8 +169,10 @@ type Db struct {
|
||||
}
|
||||
|
||||
// ensure that Db implements the interfaces of: Reader and Writer
|
||||
var _ Reader = (*Db)(nil)
|
||||
var _ Writer = (*Db)(nil)
|
||||
var (
|
||||
_ Reader = (*Db)(nil)
|
||||
_ Writer = (*Db)(nil)
|
||||
)
|
||||
|
||||
func New(underlying *gorm.DB) *Db {
|
||||
return &Db{underlying: underlying}
|
||||
@@ -344,7 +346,6 @@ func (rw *Db) CreateItems(ctx context.Context, createItems []interface{}, opt ..
|
||||
if err := rw.Create(ctx, item); err != nil {
|
||||
return errors.Wrap(err, op)
|
||||
}
|
||||
|
||||
}
|
||||
if opts.withOplog {
|
||||
if err := rw.addOplogForItems(ctx, CreateOp, opts, ticket, createItems); err != nil {
|
||||
|
||||
@@ -34,7 +34,8 @@ func TestDb_UpdateUnsetField(t *testing.T) {
|
||||
StoreTestUser: &db_test.StoreTestUser{
|
||||
PublicId: testId(t),
|
||||
Name: "default",
|
||||
}}
|
||||
},
|
||||
}
|
||||
require.NoError(t, rw.Create(context.Background(), tu))
|
||||
|
||||
updatedTu := tu.Clone().(*db_test.TestUser)
|
||||
@@ -586,9 +587,11 @@ type testUserWithVet struct {
|
||||
func (u *testUserWithVet) GetPublicId() string {
|
||||
return u.PublicId
|
||||
}
|
||||
|
||||
func (u *testUserWithVet) TableName() string {
|
||||
return "db_test_user"
|
||||
}
|
||||
|
||||
func (u *testUserWithVet) VetForWrite(ctx context.Context, r Reader, opType OpType, opt ...Option) error {
|
||||
if u.PublicId == "" {
|
||||
return stderrors.New("public id is empty string for user write")
|
||||
@@ -1029,6 +1032,7 @@ func TestDb_Exec(t *testing.T) {
|
||||
require.Equal(1, rowsAffected)
|
||||
})
|
||||
}
|
||||
|
||||
func TestDb_DoTx(t *testing.T) {
|
||||
t.Parallel()
|
||||
db, _ := TestSetup(t, "postgres")
|
||||
@@ -1901,6 +1905,7 @@ func testUser(t *testing.T, conn *gorm.DB, name, email, phoneNumber string) *db_
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func testCar(t *testing.T, conn *gorm.DB, name, model string, mpg int32) *db_test.TestCar {
|
||||
t.Helper()
|
||||
require := require.New(t)
|
||||
@@ -2274,7 +2279,7 @@ func TestClear_InputTypes(t *testing.T) {
|
||||
d int
|
||||
}
|
||||
|
||||
var tests = []struct {
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want interface{}
|
||||
@@ -2430,7 +2435,7 @@ func TestClear_Structs(t *testing.T) {
|
||||
f []string
|
||||
d int
|
||||
}
|
||||
var tests = []struct {
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want interface{}
|
||||
@@ -2676,7 +2681,7 @@ func TestClear_SetFieldsToNil(t *testing.T) {
|
||||
v interface{}
|
||||
f []string
|
||||
}
|
||||
var tests = []struct {
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want interface{}
|
||||
|
||||
@@ -17,7 +17,6 @@ func Test_Utils(t *testing.T) {
|
||||
t.Parallel()
|
||||
_, _ = TestSetup(t, "postgres")
|
||||
t.Run("nothing", func(t *testing.T) {
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -7,11 +7,12 @@
|
||||
package timestamp
|
||||
|
||||
import (
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
|
||||
timestamp "github.com/golang/protobuf/ptypes/timestamp"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -107,11 +108,14 @@ func file_controller_storage_timestamp_v1_timestamp_proto_rawDescGZIP() []byte {
|
||||
return file_controller_storage_timestamp_v1_timestamp_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_controller_storage_timestamp_v1_timestamp_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_controller_storage_timestamp_v1_timestamp_proto_goTypes = []interface{}{
|
||||
(*Timestamp)(nil), // 0: controller.storage.timestamp.v1.Timestamp
|
||||
(*timestamp.Timestamp)(nil), // 1: google.protobuf.Timestamp
|
||||
}
|
||||
var (
|
||||
file_controller_storage_timestamp_v1_timestamp_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
file_controller_storage_timestamp_v1_timestamp_proto_goTypes = []interface{}{
|
||||
(*Timestamp)(nil), // 0: controller.storage.timestamp.v1.Timestamp
|
||||
(*timestamp.Timestamp)(nil), // 1: google.protobuf.Timestamp
|
||||
}
|
||||
)
|
||||
|
||||
var file_controller_storage_timestamp_v1_timestamp_proto_depIdxs = []int32{
|
||||
1, // 0: controller.storage.timestamp.v1.Timestamp.timestamp:type_name -> google.protobuf.Timestamp
|
||||
1, // [1:1] is the sub-list for method output_type
|
||||
|
||||
Reference in new issue
Block a user