FAQ
Hello Gophers, here's my request :
I wrote a program A in its package main, which depends on a third-party
library B which I will *not* modify.
Dependency graph is thus :
  A -> B

Is there a way to execute some code *before* the initialization of package
B ?

Thank you for any clean (or dirty) ideas!
Full story here
<https://groups.google.com/forum/#!topic/google-appengine-go/ksryOEMor6c>

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Shawn Milochik at Aug 17, 2014 at 3:06 pm
    According to the spec, you can not guarantee any order of init calls. The
    only thing you can be sure of is that all init calls will happen before
    main is called.

    A good way to do what you want is, for example, the way database/sql works
    -- it exposes a method you can call to update its internal state. If
    package B in your example does not provide such a method, then this doesn't
    help you.

    What exactly is package B, and what exactly do you wish to do that requires
    execution prior to B's init?

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedAug 17, '14 at 11:38a
activeAug 17, '14 at 3:06p
posts2
users2
websitegolang.org

2 users in discussion

Shawn Milochik: 1 post Val: 1 post

People

Translate

site design / logo © 2022 Grokbase