Skip to content

Instantly share code, notes, and snippets.

View bigHave's full-sized avatar

Keith_void bigHave

  • bytedance
  • Shanghai
View GitHub Profile
@bigHave
bigHave / MoveFile.go
Created March 2, 2022 04:19 — forked from var23rav/MoveFile.go
GoLang: os.Rename() give error "invalid cross-device link" for Docker container with Volumes. MoveFile(source, destination) will work moving file between folders
import (
"fmt"
"io"
"os"
)
/*
GoLang: os.Rename() give error "invalid cross-device link" for Docker container with Volumes.
MoveFile(source, destination) will work moving file between folders
*/
@bigHave
bigHave / batch_mysql_op.go
Created January 24, 2022 08:17
batch mysql operations when use "in" condition,avoid "statement contains too many placeholders". quote from gorm.
callFc := func(tx *DB) error {
// the reflection length judgment of the optimized value
reflectLen := reflectValue.Len()
for i := 0; i < reflectLen; i += batchSize {
ends := i + batchSize
if ends > reflectLen {
ends = reflectLen
}
subtx := tx.getInstance()
@bigHave
bigHave / install_goyacc.txt
Created October 21, 2021 03:46
install goyacc
go get -u golang.org/x/tools/cmd/goyacc