From a4cd15ed525db5e740c061e39eb2dfdabd413690 Mon Sep 17 00:00:00 2001 From: liu Date: Tue, 30 May 2023 19:24:55 +0800 Subject: [PATCH] ci: support codecov (#443) --- .github/workflows/push-check-linux-x64.yml | 5 ++++- api.go | 2 +- ast/api_amd64.go | 2 +- ast/encode.go | 2 +- ast/iterator.go | 2 +- ast/node.go | 2 +- ast/parser.go | 2 +- ast/stubs_go120.go | 2 +- encoder/encoder_amd64.go | 2 +- internal/decoder/assembler_amd64_go117.go | 2 +- internal/decoder/compiler.go | 2 +- internal/decoder/debug.go | 2 +- internal/decoder/decoder.go | 2 +- internal/decoder/pools.go | 2 +- internal/decoder/stubs_go120.go | 2 +- internal/encoder/assembler_amd64_go117.go | 2 +- internal/encoder/debug_go117.go | 2 +- internal/encoder/encoder.go | 2 +- internal/encoder/errors.go | 2 +- internal/encoder/pools.go | 2 +- internal/encoder/primitives.go | 2 +- internal/encoder/stream.go | 2 +- internal/encoder/stubs_go120.go | 2 +- internal/native/avx/native_amd64.go | 2 +- internal/native/avx2/native_amd64.go | 2 +- internal/native/native_amd64.tmpl | 2 +- internal/native/sse/native_amd64.go | 2 +- loader/funcdata.go | 2 +- loader/funcdata_go120.go | 2 +- loader/loader.go | 2 +- loader/loader_go116.go | 2 +- loader/loader_go116_test.go | 2 +- loader/mmap_unix.go | 2 +- loader/pcdata.go | 2 +- utf8/utf8.go | 2 +- 35 files changed, 38 insertions(+), 35 deletions(-) diff --git a/.github/workflows/push-check-linux-x64.yml b/.github/workflows/push-check-linux-x64.yml index a9ea132..eb9a239 100644 --- a/.github/workflows/push-check-linux-x64.yml +++ b/.github/workflows/push-check-linux-x64.yml @@ -28,6 +28,9 @@ jobs: - name: Unit Test run: | - go test -v ./... + go test -race -covermode=atomic -coverprofile=coverage.txt ./... cd ./external_jsonlib_test go test -v ./... + + - name: Codecov + run: bash <(curl -s https://codecov.io/bash) diff --git a/api.go b/api.go index a042476..809d5ec 100644 --- a/api.go +++ b/api.go @@ -183,4 +183,4 @@ func Get(src []byte, path ...interface{}) (ast.Node, error) { // which can reduce unnecessary memory copy. func GetFromString(src string, path ...interface{}) (ast.Node, error) { return ast.NewSearcher(src).GetByPath(path...) -} \ No newline at end of file +} diff --git a/ast/api_amd64.go b/ast/api_amd64.go index 3047f59..7f2371c 100644 --- a/ast/api_amd64.go +++ b/ast/api_amd64.go @@ -148,4 +148,4 @@ func (self *Searcher) GetByPath(path ...interface{}) (Node, error) { return Node{}, self.parser.ExportError(err) } return newRawNode(self.parser.s[start:self.parser.p], t), nil -} \ No newline at end of file +} diff --git a/ast/encode.go b/ast/encode.go index 1187e30..38d680c 100644 --- a/ast/encode.go +++ b/ast/encode.go @@ -256,4 +256,4 @@ func (self *Node) encodeObject(buf *[]byte) error { *buf = append(*buf, '}') return nil -} \ No newline at end of file +} diff --git a/ast/iterator.go b/ast/iterator.go index 03a25b4..b193a30 100644 --- a/ast/iterator.go +++ b/ast/iterator.go @@ -161,4 +161,4 @@ type PairSlice []Pair func (self PairSlice) Sort() { radixQsort(self, 0, maxDepth(len(self))) -} \ No newline at end of file +} diff --git a/ast/node.go b/ast/node.go index 6b5ad8a..1120338 100644 --- a/ast/node.go +++ b/ast/node.go @@ -1805,4 +1805,4 @@ func unwrapError(err error) *Node { p: unsafe.Pointer(&msg), } } -} \ No newline at end of file +} diff --git a/ast/parser.go b/ast/parser.go index 0a8e7b0..2c3146c 100644 --- a/ast/parser.go +++ b/ast/parser.go @@ -615,4 +615,4 @@ func (self *Parser) ExportError(err types.ParsingError) error { Src : self.s, Code: err, }.Description()) -} \ No newline at end of file +} diff --git a/ast/stubs_go120.go b/ast/stubs_go120.go index bd6fff6..6f83052 100644 --- a/ast/stubs_go120.go +++ b/ast/stubs_go120.go @@ -52,4 +52,4 @@ var ( ) //go:linkname unquoteBytes encoding/json.unquoteBytes -func unquoteBytes(s []byte) (t []byte, ok bool) \ No newline at end of file +func unquoteBytes(s []byte) (t []byte, ok bool) diff --git a/encoder/encoder_amd64.go b/encoder/encoder_amd64.go index fa107c7..522bc88 100644 --- a/encoder/encoder_amd64.go +++ b/encoder/encoder_amd64.go @@ -105,4 +105,4 @@ var ( // // NewStreamEncoder returns a new encoder that write to w. NewStreamEncoder = encoder.NewStreamEncoder -) \ No newline at end of file +) diff --git a/internal/decoder/assembler_amd64_go117.go b/internal/decoder/assembler_amd64_go117.go index 2741373..1a4f1a7 100644 --- a/internal/decoder/assembler_amd64_go117.go +++ b/internal/decoder/assembler_amd64_go117.go @@ -1989,4 +1989,4 @@ func (self *_Assembler) WriteRecNotAX(i int, ptr obj.Addr, rec obj.Addr, saveDI self.Link("_no_writeBarrier" + strconv.Itoa(i) + "_{n}") self.Emit("MOVQ", ptr, rec) self.Link("_end_writeBarrier" + strconv.Itoa(i) + "_{n}") -} \ No newline at end of file +} diff --git a/internal/decoder/compiler.go b/internal/decoder/compiler.go index 8f3905f..e9e2b77 100644 --- a/internal/decoder/compiler.go +++ b/internal/decoder/compiler.go @@ -1152,4 +1152,4 @@ func (self *_Compiler) checkIfSkip(p *_Program, vt reflect.Type, c byte) int { p.pin(j) p.int(_OP_add, 1) return s -} \ No newline at end of file +} diff --git a/internal/decoder/debug.go b/internal/decoder/debug.go index 9cf3a6a..d5537ed 100644 --- a/internal/decoder/debug.go +++ b/internal/decoder/debug.go @@ -67,4 +67,4 @@ func (self *_Assembler) debug_instr(i int, v *_Instr) { } self.force_gc() } -} \ No newline at end of file +} diff --git a/internal/decoder/decoder.go b/internal/decoder/decoder.go index 19ad719..7cebab1 100644 --- a/internal/decoder/decoder.go +++ b/internal/decoder/decoder.go @@ -252,4 +252,4 @@ func Skip(data []byte) (start int, end int) { ret := native.SkipOne(&s, &p, m, uint64(0)) types.FreeStateMachine(m) return ret, p -} \ No newline at end of file +} diff --git a/internal/decoder/pools.go b/internal/decoder/pools.go index 06adc7f..b439b23 100644 --- a/internal/decoder/pools.go +++ b/internal/decoder/pools.go @@ -140,4 +140,4 @@ func findOrCompile(vt *rt.GoType) (_Decoder, error) { } else { return nil, err } -} \ No newline at end of file +} diff --git a/internal/decoder/stubs_go120.go b/internal/decoder/stubs_go120.go index cde6a19..ea97fcb 100644 --- a/internal/decoder/stubs_go120.go +++ b/internal/decoder/stubs_go120.go @@ -108,4 +108,4 @@ func memclrHasPointers(ptr unsafe.Pointer, n uintptr) //go:noescape //go:linkname memclrNoHeapPointers runtime.memclrNoHeapPointers //goland:noinspection GoUnusedParameter -func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) \ No newline at end of file +func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) diff --git a/internal/encoder/assembler_amd64_go117.go b/internal/encoder/assembler_amd64_go117.go index 1f1b280..79efe75 100644 --- a/internal/encoder/assembler_amd64_go117.go +++ b/internal/encoder/assembler_amd64_go117.go @@ -1199,4 +1199,4 @@ func (self *_Assembler) WriteRecNotAX(i int, ptr obj.Addr, rec obj.Addr) { self.Link("_no_writeBarrier" + strconv.Itoa(i) + "_{n}") self.Emit("MOVQ", ptr, rec) self.Link("_end_writeBarrier" + strconv.Itoa(i) + "_{n}") -} \ No newline at end of file +} diff --git a/internal/encoder/debug_go117.go b/internal/encoder/debug_go117.go index e1016de..7311f34 100644 --- a/internal/encoder/debug_go117.go +++ b/internal/encoder/debug_go117.go @@ -202,4 +202,4 @@ func (self *_Assembler) print_ptr(i int, ptr obj.Addr, lea bool) { self.Emit("MOVQ", _R10, _BX) self.dcall(_F_printptr) self.dload(_REG_debug...) -} \ No newline at end of file +} diff --git a/internal/encoder/encoder.go b/internal/encoder/encoder.go index 3c46061..b7c08e9 100644 --- a/internal/encoder/encoder.go +++ b/internal/encoder/encoder.go @@ -325,4 +325,4 @@ func Valid(data []byte) (ok bool, start int) { } return true, ret -} \ No newline at end of file +} diff --git a/internal/encoder/errors.go b/internal/encoder/errors.go index ac6848a..6e9d0c7 100644 --- a/internal/encoder/errors.go +++ b/internal/encoder/errors.go @@ -62,4 +62,4 @@ func goPanic(code int, val unsafe.Pointer) { default: panic("encoder error!") } -} \ No newline at end of file +} diff --git a/internal/encoder/pools.go b/internal/encoder/pools.go index 9892ba1..a2800dd 100644 --- a/internal/encoder/pools.go +++ b/internal/encoder/pools.go @@ -190,4 +190,4 @@ func pretouchRec(vtm map[reflect.Type]uint8, opts option.CompileOptions) error { } opts.RecursiveDepth -= 1 return pretouchRec(next, opts) -} \ No newline at end of file +} diff --git a/internal/encoder/primitives.go b/internal/encoder/primitives.go index 78fb29f..3180389 100644 --- a/internal/encoder/primitives.go +++ b/internal/encoder/primitives.go @@ -165,4 +165,4 @@ func asJson(v unsafe.Pointer) (string, error) { text := assertI2I(_T_json_Marshaler, *(*rt.GoIface)(v)) r, e := (*(*json.Marshaler)(unsafe.Pointer(&text))).MarshalJSON() return rt.Mem2Str(r), e -} \ No newline at end of file +} diff --git a/internal/encoder/stream.go b/internal/encoder/stream.go index 8f73a2b..b6f3ce5 100644 --- a/internal/encoder/stream.go +++ b/internal/encoder/stream.go @@ -81,4 +81,4 @@ func (enc *StreamEncoder) Encode(val interface{}) (err error) { free_bytes: freeBytes(out) return err -} \ No newline at end of file +} diff --git a/internal/encoder/stubs_go120.go b/internal/encoder/stubs_go120.go index f1a7d10..2cabc8b 100644 --- a/internal/encoder/stubs_go120.go +++ b/internal/encoder/stubs_go120.go @@ -63,4 +63,4 @@ func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) var _runtime_writeBarrier uintptr //go:linkname gcWriteBarrierAX runtime.gcWriteBarrier -func gcWriteBarrierAX() \ No newline at end of file +func gcWriteBarrierAX() diff --git a/internal/native/avx/native_amd64.go b/internal/native/avx/native_amd64.go index d6a8610..43a5249 100644 --- a/internal/native/avx/native_amd64.go +++ b/internal/native/avx/native_amd64.go @@ -132,4 +132,4 @@ func __validate_utf8(s *string, p *int, m *types.StateMachine) (ret int) //go:nosplit //go:noescape //goland:noinspection GoUnusedParameter -func __validate_utf8_fast(s *string) (ret int) \ No newline at end of file +func __validate_utf8_fast(s *string) (ret int) diff --git a/internal/native/avx2/native_amd64.go b/internal/native/avx2/native_amd64.go index bebd83c..7ce533f 100644 --- a/internal/native/avx2/native_amd64.go +++ b/internal/native/avx2/native_amd64.go @@ -132,4 +132,4 @@ func __validate_utf8(s *string, p *int, m *types.StateMachine) (ret int) //go:nosplit //go:noescape //goland:noinspection GoUnusedParameter -func __validate_utf8_fast(s *string) (ret int) \ No newline at end of file +func __validate_utf8_fast(s *string) (ret int) diff --git a/internal/native/native_amd64.tmpl b/internal/native/native_amd64.tmpl index 40cbf16..2ade18f 100644 --- a/internal/native/native_amd64.tmpl +++ b/internal/native/native_amd64.tmpl @@ -130,4 +130,4 @@ func __validate_utf8(s *string, p *int, m *types.StateMachine) (ret int) //go:nosplit //go:noescape //goland:noinspection GoUnusedParameter -func __validate_utf8_fast(s *string) (ret int) \ No newline at end of file +func __validate_utf8_fast(s *string) (ret int) diff --git a/internal/native/sse/native_amd64.go b/internal/native/sse/native_amd64.go index cb30a0e..8dd0aa1 100644 --- a/internal/native/sse/native_amd64.go +++ b/internal/native/sse/native_amd64.go @@ -132,4 +132,4 @@ func __validate_utf8(s *string, p *int, m *types.StateMachine) (ret int) //go:nosplit //go:noescape //goland:noinspection GoUnusedParameter -func __validate_utf8_fast(s *string) (ret int) \ No newline at end of file +func __validate_utf8_fast(s *string) (ret int) diff --git a/loader/funcdata.go b/loader/funcdata.go index 9b760f6..9362a24 100644 --- a/loader/funcdata.go +++ b/loader/funcdata.go @@ -141,4 +141,4 @@ func funcNameParts(name string) (string, string, string) { return name, "", "" } return name[:i], "[...]", name[j+1:] -} \ No newline at end of file +} diff --git a/loader/funcdata_go120.go b/loader/funcdata_go120.go index 906fe37..73d751b 100644 --- a/loader/funcdata_go120.go +++ b/loader/funcdata_go120.go @@ -542,4 +542,4 @@ func makePctab(funcs []Func, cuOffset []uint32, nameOffset []int32) (pctab []byt return } -func registerFunction(name string, pc uintptr, textSize uintptr, fp int, args int, size uintptr, argptrs uintptr, localptrs uintptr) {} \ No newline at end of file +func registerFunction(name string, pc uintptr, textSize uintptr, fp int, args int, size uintptr, argptrs uintptr, localptrs uintptr) {} diff --git a/loader/loader.go b/loader/loader.go index 929d8c2..43eaeb4 100644 --- a/loader/loader.go +++ b/loader/loader.go @@ -34,4 +34,4 @@ type Loader struct { Name string // module name File string // file name Options -} \ No newline at end of file +} diff --git a/loader/loader_go116.go b/loader/loader_go116.go index ea30ec9..46e630f 100644 --- a/loader/loader_go116.go +++ b/loader/loader_go116.go @@ -101,4 +101,4 @@ func Load(text []byte, funcs []Func, modulename string, filenames []string) (out out[i] = Function(&m) } return -} \ No newline at end of file +} diff --git a/loader/loader_go116_test.go b/loader/loader_go116_test.go index 0505bc8..323c1f4 100644 --- a/loader/loader_go116_test.go +++ b/loader/loader_go116_test.go @@ -139,4 +139,4 @@ func TestLoad(t *testing.T) { require.Equal(t, 2, j) require.Equal(t, "hook1", hstr) -} \ No newline at end of file +} diff --git a/loader/mmap_unix.go b/loader/mmap_unix.go index 50b80bf..3ea944e 100644 --- a/loader/mmap_unix.go +++ b/loader/mmap_unix.go @@ -42,4 +42,4 @@ func mprotect(p uintptr, nb int) { if _, _, err := syscall.RawSyscall(syscall.SYS_MPROTECT, p, uintptr(nb), _RX); err != 0 { panic(err) } -} \ No newline at end of file +} diff --git a/loader/pcdata.go b/loader/pcdata.go index b5c62d1..8074a12 100644 --- a/loader/pcdata.go +++ b/loader/pcdata.go @@ -97,4 +97,4 @@ func (self Pcdata) MarshalBinary() (data []byte, err error) { sv = v.Val } return -} \ No newline at end of file +} diff --git a/utf8/utf8.go b/utf8/utf8.go index 59d2cae..52c35fb 100644 --- a/utf8/utf8.go +++ b/utf8/utf8.go @@ -68,4 +68,4 @@ func Validate(src []byte) bool { // ValidateString as Validate, but for string. func ValidateString(src string) bool { return native.ValidateUTF8Fast(&src) == 0 -} \ No newline at end of file +}