pangpanglabs / echosample Goto Github PK
View Code? Open in Web Editor NEWecho framework sample project
echo framework sample project
This code will cause data competition
package main
import (
"fmt"
)
type Fruit struct {
Name string
}
func main() {
Race()
}
func Race() (newFruit Fruit) {
go func() {
newFruit = Fruit{Name: "Pear"}
}()
fmt.Printf("race3:exp:Pear,act:%v", newFruit.Name)
return
}
//go run --race main.go
out put
PS D:\source\gopath\src\race\gofunc> go run --race main.go
race3:exp:Pear,act:==================
WARNING: DATA RACE
Write at 0x00c00003e1d0 by goroutine 6:
main.Race.func1()
D:/source/gopath/src/race/gofunc/main.go:17 +0x3f
Previous read at 0x00c00003e1d0 by main goroutine:
runtime.convT2Estring()
C:/GO/src/runtime/iface.go:332 +0x0
main.Race()
D:/source/gopath/src/race/gofunc/main.go:19 +0x8e
main.main()
D:/source/gopath/src/race/gofunc/main.go:13 +0x36
Goroutine 6 (running) created at:
main.Race()
D:/source/gopath/src/race/gofunc/main.go:16 +0x6c
main.main()
D:/source/gopath/src/race/gofunc/main.go:13 +0x36
==================
Found 1 data race(s)
exit status 66
After creating or updating, CreateAt
, UpdatedAt
fields are not set.
It maybe Tx issue.
Now, echomiddleware.ContextDB is registered first, then echomiddleware.BehaviorLogger.
This will cause can't set requestId in sqllog.
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.