niubaoshu / gotiny Goto Github PK
View Code? Open in Web Editor NEWgotiny 是一个高效的golang序列化库。
License: MIT License
gotiny 是一个高效的golang序列化库。
License: MIT License
example doesn't work here:
https://goplay.space/#pW5NXJSa8DG
I believe better examples should be provided for anyone new to this library that uses the same convention as encoding/gob
.
Decoding:
var foo map[string]string
if err = gob.NewDecoder(file).Decode(&foo); err != nil {
return err
}
Encoding:
buf := new(bytes.Buffer)
if err := gob.NewEncoder(buf).Encode(foo); err != nil {
return err
}
Note: file
is *os.File
returned by os.Open(path)
.
As far as I can tell, your functions don't return any errors. Is this intentional?
Hello.
Your library doesn't work with go modules, as is demonstrated below:
To reproduce:
$ go get github.com/niubaoshu/gotiny
$ cp -r $GOPATH/src/github.com/niubaoshu/gotiny/example /tmp
$ mv /tmp/example/helloworld.go /tmp/example/main.go
$ go mod init main
$ go mod vendor
$ go build
or
$ go build -mod vendor
Output from go build
:
# main
./main.go:12:2: undefined: gotiny.Unmarshal
./main.go:12:19: undefined: gotiny.Marshal
./main.go:19:5: dec.DecodeValue undefined (type *gotiny.Decoder has no field or method DecodeValue)
./main.go:19:21: enc.EncodeValue undefined (type *gotiny.Encoder has no field or method EncodeValue)
Hi,
The newly released Go 1.18 breaks this with the following when building:
.\unsafe.go:47:3: //go:linkname must refer to declared function or variable
Hello, am having an issue while using this library with the race detector enabled.
the error message is: fatal error: checkptr: pointer arithmetic result points to invalid allocation
The issue is very easy to reproduce, just use the next code:
package gotiny
import (
"github.com/niubaoshu/gotiny"
"testing"
)
func TestGoTinyArray(t *testing.T){
strings := []string{"1","2"}
gotiny.Marshal(&strings)
}
Then execute the test with the race detector enabled:
go test -v -race -run TestGoTinyArray
go version: go1.16.14 darwin/amd64
how to convert interface types? possible?
你好,这仍然被认为还没有准备好生产吗? 谢谢
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.