summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bareish/baregen/baregen.go6
-rw-r--r--bareish/schema/ast.go56
-rw-r--r--bareish/schema/lex.go4
-rw-r--r--bareish/schema/parser.go4
-rw-r--r--bareish/schema/unparse.go2
-rw-r--r--bareish/unions.go6
6 files changed, 40 insertions, 38 deletions
diff --git a/bareish/baregen/baregen.go b/bareish/baregen/baregen.go
index 2e1725b..76b5bff 100644
--- a/bareish/baregen/baregen.go
+++ b/bareish/baregen/baregen.go
@@ -201,15 +201,15 @@ func main() {
log.Fatalf("--- error formatting source code: %v", err)
}
- err = os.WriteFile(cfg.Out, formatted, 0644)
+ err = os.WriteFile(cfg.Out, formatted, 0o644)
if err != nil {
log.Fatalf("error writing output to %s: %e", cfg.Out, err)
}
}
type Config struct {
- In string
- Out string
+ In string
+ Out string
}
func parseArgs() *Config {
diff --git a/bareish/schema/ast.go b/bareish/schema/ast.go
index d016eba..99610a8 100644
--- a/bareish/schema/ast.go
+++ b/bareish/schema/ast.go
@@ -7,7 +7,7 @@ type SchemaType interface {
}
type UserDefinedType struct {
- name string
+ name string
type_ Type
}
@@ -95,57 +95,57 @@ const (
func (tk TypeKind) String() string {
switch tk {
case UINT:
- return "UINT";
+ return "UINT"
case U8:
- return "U8";
+ return "U8"
case U16:
- return "U16";
+ return "U16"
case U32:
- return "U32";
+ return "U32"
case U64:
- return "U64";
+ return "U64"
case INT:
- return "INT";
+ return "INT"
case I8:
- return "I8";
+ return "I8"
case I16:
- return "I16";
+ return "I16"
case I32:
- return "I32";
+ return "I32"
case I64:
- return "I64";
+ return "I64"
case F32:
- return "F32";
+ return "F32"
case F64:
- return "F64";
+ return "F64"
case Bool:
- return "Bool";
+ return "Bool"
case String:
- return "String";
+ return "String"
case Void:
- return "Void";
+ return "Void"
case Data:
- return "Data";
+ return "Data"
case DataFixed:
- return "DataFixed";
+ return "DataFixed"
case Array:
- return "Array";
+ return "Array"
case Slice:
- return "Slice";
+ return "Slice"
case Optional:
- return "Optional";
+ return "Optional"
case DataArray:
- return "DataArray";
+ return "DataArray"
case DataSlice:
- return "DataSlice";
+ return "DataSlice"
case Map:
- return "Map";
+ return "Map"
case Union:
- return "Union";
+ return "Union"
case Struct:
- return "Struct";
+ return "Struct"
case UserType:
- return "UserType";
+ return "UserType"
default:
return "?"
}
@@ -265,7 +265,7 @@ func (st *StructType) Fields() []StructField {
}
type StructField struct {
- name string
+ name string
type_ Type
}
diff --git a/bareish/schema/lex.go b/bareish/schema/lex.go
index a3db33a..680ea3e 100644
--- a/bareish/schema/lex.go
+++ b/bareish/schema/lex.go
@@ -110,7 +110,7 @@ func (sc *Scanner) scanWord() (Token, error) {
for {
r, _, err := sc.br.ReadRune()
- if err != nil {
+ if err != nil {
if err == io.EOF {
break
}
@@ -177,7 +177,7 @@ func (sc *Scanner) scanInteger() (Token, error) {
for {
r, _, err := sc.br.ReadRune()
- if err != nil {
+ if err != nil {
if err == io.EOF {
break
}
diff --git a/bareish/schema/parser.go b/bareish/schema/parser.go
index c51bfcb..bd0e488 100644
--- a/bareish/schema/parser.go
+++ b/bareish/schema/parser.go
@@ -10,8 +10,8 @@ import (
var (
userTypeNameRE = regexp.MustCompile(`[A-Z][A-Za-z0-9]*`)
userEnumNameRE = regexp.MustCompile(`[A-Z][A-Za-z0-9]*`)
- fieldNameRE = regexp.MustCompile(`[a-z][A-Za-z0-9]*`)
- enumValueRE = regexp.MustCompile(`[A-Z][A-Z0-9_]*`)
+ fieldNameRE = regexp.MustCompile(`[a-z][A-Za-z0-9]*`)
+ enumValueRE = regexp.MustCompile(`[A-Z][A-Z0-9_]*`)
)
// Returned when the lexer encounters an unexpected token
diff --git a/bareish/schema/unparse.go b/bareish/schema/unparse.go
index 0fb1448..23bb5f5 100644
--- a/bareish/schema/unparse.go
+++ b/bareish/schema/unparse.go
@@ -11,7 +11,7 @@ import (
)
var (
- intType = reflect.TypeOf(bareish.Int(0))
+ intType = reflect.TypeOf(bareish.Int(0))
uintType = reflect.TypeOf(bareish.Uint(0))
)
diff --git a/bareish/unions.go b/bareish/unions.go
index 48565b7..b1d5780 100644
--- a/bareish/unions.go
+++ b/bareish/unions.go
@@ -18,8 +18,10 @@ type UnionTags struct {
types map[uint64]reflect.Type
}
-var unionInterface = reflect.TypeOf((*Union)(nil)).Elem()
-var unionRegistry map[reflect.Type]*UnionTags
+var (
+ unionInterface = reflect.TypeOf((*Union)(nil)).Elem()
+ unionRegistry map[reflect.Type]*UnionTags
+)
func init() {
unionRegistry = make(map[reflect.Type]*UnionTags)