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