Git Product home page Git Product logo

Comments (4)

maddyblue avatar maddyblue commented on July 4, 2024

It sounds ok to me. Let's consider if there's a better API. How about making the context exported? This allows for the above functionality without a getter function (which I favor). However it does expose this, so it can be changed (which could cause problems, but we can document that and don't have to make guarantees). Are there any downsides to that?

from goon.

markmandel avatar markmandel commented on July 4, 2024

Yeah I was wondering about making the Context public, so changing the Goon definition to:

type Goon struct {
    Context      appengine.Context
    ...
}

But my concern as well was people being able to mess with the Context, which concerned me, hence my use of the getter.

That's the only issue I had. But yeah, if we document it, I'm not seeing a huge issue.

from goon.

maddyblue avatar maddyblue commented on July 4, 2024

Considering that this is legal (although it panics):

package main

import "net/http"

func main() {
    http.DefaultClient = nil
    http.Get("http://google.com")
}

it seems that the Go style is accessor methods aren't worth it because the programmer is already supposed to know what to do. Unless other evidence is presented, I'm in favor of exporting it.

from goon.

markmandel avatar markmandel commented on July 4, 2024

👍 Agreed. I'll get hacking on it, should be an easy change.

from goon.

Related Issues (20)

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.