Git Product home page Git Product logo

pkg's Introduction

Common MOSN Packages

Common utility packages leveraged by other repos.

Install

go get mosn.io/pkg

pkg's People

Contributors

3062 avatar antjack avatar cch-4321 avatar cch123 avatar codefromthecrypt avatar dengqian avatar doujiang24 avatar fdingiit avatar nejisama avatar tanc010 avatar taoyuanyuan avatar wangfakang avatar wenxuwan avatar yidwang avatar zhenjunma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pkg's Issues

Weekly Digest (10 April, 2020 - 17 April, 2020)

Here's the Weekly Digest for mosn/pkg:


ISSUES

Last week, no issues were created.


PULL REQUESTS

Last week, no pull requests were created, updated or merged.


COMMITS

Last week there were no commits.


CONTRIBUTORS

Last week there were no contributors.


STARGAZERS

Last week there were no stargazers.


RELEASES

Last week there were no releases.


That's all for last week, please 👀 Watch and Star the repository mosn/pkg to receive next weekly updates. 😃

You can also view all Weekly Digests by clicking here.

Your Weekly Digest bot. 📆

在mac m1 中Dup3方法找不到的问题

我最近使用到了pkg/blob/master/utils/dup_arm64.go里的Dup方法,提示Dup3方法找不到,错误信息如下:

# mosn.io/pkg/utils
../../go/pkg/mod/github.com/wenxuwan/[email protected]/utils/dup_arm64.go:8:9: undefined: syscall.Dup3

我的电脑是mac m1,golang版本是go1.16.3.darwin-arm64,go env如下:

GO111MODULE="on"
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/mrbinary/Library/Caches/go-build"
GOENV="/Users/mrbinary/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/mrbinary/go/pkg/mod"
GONOPROXY="gitlab.com"
GONOSUMDB="gitlab.com"
GOOS="darwin"
GOPATH="/Users/mrbinary/go"
GOPRIVATE="github.com"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.16.3"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/ny/w9t1brsx7hq3gjc0tlfy6yyc0000gn/T/go-build2969965340=/tmp/go-build -gno-record-gcc-switches -fno-common"

关于 goroutine 包中 GoWithRecover 函数拆分

pkg/utils/goroutine.go

Lines 41 to 60 in e3528ea

func GoWithRecover(handler func(), recoverHandler func(r interface{})) {
go func() {
defer func() {
if r := recover(); r != nil {
recoverLogger(os.Stderr, r)
if recoverHandler != nil {
go func() {
defer func() {
if p := recover(); p != nil {
recoverLogger(os.Stderr, p)
}
}()
recoverHandler(r)
}()
}
}
}()
handler()
}()
}

这里的 GoWithRecover 是不是拆成两个函数比较好,我在使用 errgroup 需要传入裸函数,这样拆分可以使用到 recover 机制,同时是否开启 goroutine 交给用户决定。

 func GoWithRecover(handler func(), recoverHandler func(r interface{})) { 
 	go func() { 
 		WithRecover(handler, recoverHandler)
 	}() 
 } 

func WithRecover(handler func(), recoverHandler func(r interface{})) {
              defer func() { 
 			if r := recover(); r != nil { 
 				recoverLogger(os.Stderr, r) 
 				if recoverHandler != nil { 
 					go func() { 
 						defer func() { 
 							if p := recover(); p != nil { 
 								recoverLogger(os.Stderr, p) 
 							} 
 						}() 
 						recoverHandler(r) 
 					}() 
 				} 
 			} 
 		}() 
 		handler() 
}

Weekly Digest (10 April, 2020 - 17 April, 2020)

Here's the Weekly Digest for mosn/pkg:


ISSUES

Last week, no issues were created.


PULL REQUESTS

Last week, no pull requests were created, updated or merged.


COMMITS

Last week there were no commits.


CONTRIBUTORS

Last week there were no contributors.


STARGAZERS

Last week there were no stargazers.


RELEASES

Last week there were no releases.


That's all for last week, please 👀 Watch and Star the repository mosn/pkg to receive next weekly updates. 😃

You can also view all Weekly Digests by clicking here.

Your Weekly Digest bot. 📆

日志库 Panic

通过 InitGlobalRoller 更新 roller 从 log.Roller{MaxTime: 24 * 60 * 60} 到 log.Roller{MaxSize: 100, MaxAge: 7, MaxBackups: 10} 发生 panic。
目前只支持:修改 MaxSize 字段吗?而且 MaxSize 这个字段不可以修改为0。

May be the Rotate function should be configurable for user

Hi

Now the log rotate function not configurable, may be should support user define own rotate function.

In our platform a script will find the file with format mosn_2020-xx-xx:14:00:00.log and will delete them period. So i need own rotate function to rename the file with our format.

Add support for http trailers and full range keys

fasthttp implements trailing headers as a part of the http request and response headers objects. To ensure we can use these without relying on fasthttp API, we need a few more functions, which I'm happy to implement after #65 is in. I need this to help support the new http-wasm host, which has glitches both in trailers and also multiple header values.

  • GetKeys and GetKeysTrailer, to return all keys including ones special-cased internally by fasthttp
    • this is much easier than having users do a range function, as well more precise to unit test
  • GetTrailer to return a single trailer
  • AddTrailer to add a single trailer field for a key
  • SetTrailer to overwrite a trailer with a single value
  • DelTrailer to delete all trailers for a key
  • GetAll and GetAllTrailer function to return all values for a key
    • this is much easier than having users do a range function, as well more precise to unit test

cc @taoyuanyuan I'll backfill unit tests and polish up stuff, but probably this should be done separate from the version bump

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.