GithubHelp home page GithubHelp logo

bcd-util's Introduction

跨平台编译

  • macos跨平台编译

    • CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o build/bcd-util-macos
    • CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/bcd-util-linux
    • CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o build/bcd-util-windows.exe
  • windows跨平台编译

    • set CGO_ENABLED=0&&set GOOS=darwin&&set GOARCH=amd64&&go build -o build/bcd-util-macos
    • set CGO_ENABLED=0&&set GOOS=linux&&set GOARCH=amd64&&go build -o build/bcd-util-linux
    • set CGO_ENABLED=0&&set GOOS=windows&&set GOARCH=amd64&&go build -o build/bcd-util-windows.exe

错误处理

使用第三方包errors

需要注意的是、为了获得更好的堆栈信息、需要遵循如下规则

  • 所有调用第三方包返回的error、必须使用 errors.WithStack() 包装后再返回上层
  • 所有调用自己方法返回的error、直接返回到上层即可
  • 所有根据errors方法产生的error、直接返回到上层即可

这样可以保证、所有返回的错误都有堆栈信息、且只包含一份堆栈信息

因为使用WithStack处理errors返回或者处理过的错误、会导致附加多次堆栈信息

bcd-util's People

Contributors

baichangda avatar

Watchers

 avatar

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.