all: check formatting on CI
Этот коммит содержится в:
родитель
1322f404a6
коммит
02ecab833f
6 изменённых файлов: 14 добавлений и 9 удалений
|
@ -95,6 +95,7 @@ commands:
|
|||
paths:
|
||||
- ~/.cache/go-build
|
||||
- ~/.cache/tinygo
|
||||
- run: make fmt-check
|
||||
build-linux:
|
||||
steps:
|
||||
- checkout
|
||||
|
|
6
Makefile
6
Makefile
|
@ -92,9 +92,11 @@ endif
|
|||
clean:
|
||||
@rm -rf build
|
||||
|
||||
FMT_PATHS = ./*.go compiler interp ir loader src/device/arm src/examples src/machine src/os src/reflect src/runtime src/sync src/syscall
|
||||
fmt:
|
||||
@go fmt . ./compiler ./interp ./loader ./ir ./src/device/arm ./src/examples/* ./src/machine ./src/os ./src/runtime ./src/sync ./src/syscall
|
||||
@go fmt ./testdata/*.go
|
||||
@gofmt -l -w $(FMT_PATHS)
|
||||
fmt-check:
|
||||
@unformatted=$$(gofmt -l $(FMT_PATHS)); [ -z "$$unformatted" ] && exit 0; echo "Unformatted:"; for fn in $$unformatted; do echo " $$fn"; done; exit 1
|
||||
|
||||
test:
|
||||
@go test -v .
|
||||
|
|
|
@ -35,7 +35,7 @@ func (info *fileInfo) parseFragment(fragment string, cflags []string, posFilenam
|
|||
index := C.clang_createIndex(0, 0)
|
||||
defer C.clang_disposeIndex(index)
|
||||
|
||||
filenameC := C.CString(posFilename+"!cgo.c")
|
||||
filenameC := C.CString(posFilename + "!cgo.c")
|
||||
defer C.free(unsafe.Pointer(filenameC))
|
||||
|
||||
fragmentC := C.CString(fragment)
|
||||
|
|
|
@ -134,18 +134,18 @@ func (t Type) String() string {
|
|||
}
|
||||
|
||||
func (t Type) Kind() Kind {
|
||||
if t % 2 == 0 {
|
||||
if t%2 == 0 {
|
||||
// basic type
|
||||
return Kind((t >> 1) % 32)
|
||||
} else {
|
||||
return Kind(t >> 1) % 8 + 19
|
||||
return Kind(t>>1)%8 + 19
|
||||
}
|
||||
}
|
||||
|
||||
func (t Type) Elem() Type {
|
||||
switch t.Kind() {
|
||||
case Chan, Ptr, Slice:
|
||||
if (t >> 4) % 2 != 0 {
|
||||
if (t>>4)%2 != 0 {
|
||||
panic("unimplemented: (reflect.Type).Elem() for named types")
|
||||
}
|
||||
return t >> 5
|
||||
|
|
|
@ -335,7 +335,7 @@ func (v Value) Index(i int) Value {
|
|||
typecode: v.Type().Elem(),
|
||||
indirect: true,
|
||||
}
|
||||
addr := uintptr(slice.Data) + elem.Type().Size() * uintptr(i) // pointer to new value
|
||||
addr := uintptr(slice.Data) + elem.Type().Size()*uintptr(i) // pointer to new value
|
||||
elem.value = unsafe.Pointer(addr)
|
||||
return elem
|
||||
case String:
|
||||
|
@ -348,7 +348,7 @@ func (v Value) Index(i int) Value {
|
|||
}
|
||||
return Value{
|
||||
typecode: Uint8.basicType(),
|
||||
value: unsafe.Pointer(uintptr(*(*uint8)(unsafe.Pointer(s.Data + uintptr(i))))),
|
||||
value: unsafe.Pointer(uintptr(*(*uint8)(unsafe.Pointer(s.Data + uintptr(i))))),
|
||||
}
|
||||
case Array:
|
||||
panic("unimplemented: (reflect.Value).Index()")
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
TheVersion = `go0.1.0`
|
||||
package sys
|
||||
|
||||
const TheVersion = `go0.1.0`
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче