-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
491 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package jsonry | ||
|
||
import "reflect" | ||
|
||
func public(field reflect.StructField) bool { | ||
return field.PkgPath == "" | ||
} | ||
|
||
func basicType(k reflect.Kind) bool { | ||
switch k { | ||
case reflect.String, reflect.Bool, | ||
reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, | ||
reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, | ||
reflect.Float32, reflect.Float64: | ||
return true | ||
default: | ||
return false | ||
} | ||
} | ||
|
||
type valueDetails struct { | ||
realValue reflect.Value | ||
realType reflect.Type | ||
realKind reflect.Kind | ||
pointer bool | ||
} | ||
|
||
func inspectValue(v reflect.Value) valueDetails { | ||
k := v.Kind() | ||
switch k { | ||
case reflect.Ptr: | ||
r := inspectValue(v.Elem()) | ||
r.pointer = true | ||
return r | ||
case reflect.Interface: | ||
return inspectValue(v.Elem()) | ||
case reflect.Invalid: | ||
return valueDetails{ | ||
realValue: v, | ||
realType: nil, | ||
realKind: k, | ||
pointer: false, | ||
} | ||
default: | ||
return valueDetails{ | ||
realValue: v, | ||
realType: v.Type(), | ||
realKind: k, | ||
pointer: false, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
#!/usr/bin/env sh | ||
|
||
set +e | ||
|
||
go run honnef.co/go/tools/cmd/staticcheck ./... | ||
go run github.com/onsi/ginkgo/ginkgo -r |
Oops, something went wrong.