Giter VIP home page Giter VIP logo

golangadvance's People

Contributors

nghiait123456 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  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  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  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

golangadvance's Issues

Avoiding string to bytes conversion example is wrong.

At b85fa2d, in this file, both BenchmarkBad and BenchmarkGood causes []byte("Hello world") escape to heap:

 $ go test -c -gcflags=-m p_test.go 
# command-line-arguments [command-line-arguments.test]
./p_test.go:8:19: b does not escape
./p_test.go:11:14: ([]byte)("Hello world") escapes to heap
./p_test.go:14:13: ... argument does not escape
./p_test.go:14:14: a escapes to heap
./p_test.go:17:20: b does not escape
./p_test.go:19:17: ([]byte)("Hello world") escapes to heap
./p_test.go:23:13: ... argument does not escape
./p_test.go:23:14: a escapes to heap
# command-line-arguments.test
_testmain.go:39:6: can inline init.0
_testmain.go:47:24: inlining call to testing.MainStart
_testmain.go:47:42: testdeps.TestDeps{} escapes to heap
_testmain.go:47:24: &testing.M{...} escapes to heap

The reason BenchmarkBad is worse because the escaping happens inside the loop, it does not relate to string to bytes conversion operation.

Inheritance in Golang

In here: Inheritance , you said:

Golang has a flexible and powerful inheritance approach

I think writing like that would be easy to misunderstand. Go doesn’t have inheritance – instead composition. The implementations may look the same, but the concepts are totally different.

However, Inheritance Is Evil. Stop Using It. I think that why Go doesn't have inheritance. And I suggest limited use of Inheritance in the real projects in any language if possible.

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.