/srv/irclogs.ubuntu.com/2012/12/20/#juju-dev.txt

jamwallyworld_: I figured out what broke the test suite for the "no such variable hostname".04:19
jamThe issue is that "hostname" is defined in service_test.go, but used in "service_http.go".04:19
wallyworld_ah ok, i looked but didn't see how i broke it04:19
jamSo everything works fine when you run tests in novaserviec04:19
wallyworld_i found that too04:19
jambecause it imports the test files to run the test suite.04:20
jambut when "nova" tests import "service_http"04:20
jamit doesn't import the test files04:20
jam(because it shouldn't)04:20
wallyworld_makes sense04:20
jamso it is one of those cases where test definitions leak and make real code pass04:20
jamwhen it is broken if you try to use it directly.04:20
wallyworld_too bad go fmt doesn't check compilation04:21
wallyworld_there's also another breakage04:21
jamwallyworld_: right, so "go build" doesn't work in the novaservice directory04:21
wallyworld_to do with nova something or other not implementinng HTTPServe04:21
jamso we should be using: go build ./... && go test ./...04:21
wallyworld_go test ./... fails if there is a compile error04:21
wallyworld_so perhaps go build is redundant there04:22
jamand, as I've said before, global state is terrible, we shouldn't have it in the first place.04:22
wallyworld_yeah, agree04:22
jamwallyworld_: As I just said, cd testservice/novaservice ; go test passes04:22
jamgo build fails04:22
jamwe didn't *notice* until we used novaservice in nova testing.04:22
wallyworld_hmm, i've never seen go test not have an error if go build fails04:22
jambecause nova doesn't import the novaservice test package04:22
jamwallyworld_: try it right now with trunk04:23
wallyworld_i'm prototyping in trunk, so it's a bt hard atm04:23
wallyworld_i need to create a new branch to work in04:23
jamwallyworld_: essentially, we had a latent build failure that we didn't see at r40, in r41 you started importing the code, and triggered the failure.04:23
jamwallyworld_: "bzr shelve" ?04:23
wallyworld_yeah, but i don't want to disrupt my train of thought just atm04:24
jamwallyworld_: np04:24
wallyworld_thanks for looking into that further, i was going to mention itagain at the standup04:24
hazmatso for updating the juju-core src tree w. goose .. what do folks do.. go get -u ?04:25
jamhazmat: yes04:26
jamits not perfect, but it seems to be the best we have right now04:26
hazmatjam.. with what value/pkg name?04:26
jamhazmat: "go get -u launchpad.net/juju-core/..."04:26
jamshould also update all dependencies04:26
hazmatjam, thanks04:26
* hazmat always forgets where to put ...04:27
hazmati'm sure its easy once your used to it04:28
* hazmat wonders if roger published his api callee tool04:30
hazmataha http://godoc.org/code.google.com/p/rog-go/exp/cmd/gosym04:32
=== _mup__ is now known as _mup_
jamwallyworld_: poke if you are still around12:01
wallyworld_hi12:02
jamwallyworld_: so it might just be naming, but I'm looking over the code you pushed up, and it doesn't quite sit right.12:03
wallyworld_which bit?12:03
jam"unauthenticatedClient": IMO unauthenticated is a state that can be remedied by authenticating12:03
wallyworld_ok, i am happy to change names12:04
jamand having an Authenticator that doesn't authenticate...12:04
wallyworld_it's a means to allow code to be shared12:04
wallyworld_so the core logic to send requests can be ignorant of if it is running with somwthing that needs authenticatin12:05
wallyworld_so the authentication stuff is just noops12:05
jamso, nonAuthenticatingClient seems to me like a client that wouldn't try to authenticate (naming), but I don't know that it would be an Authenticator.12:05
jamwallyworld_: but is that better than just having a boolean about whether it *needs* to authenticate?12:05
wallyworld_hmmm. i could look at that for sure12:06
wallyworld_the AUthentication interface though also provides MakeServiceURL12:06
wallyworld_since that is different depending on the type of client12:07
wallyworld_and go doesn't support virtual methods :-(12:07
wallyworld_i really wanted to do it differently, like I would have in Java or C++, but alas12:07
jamwallyworld_: I agree that we likely need an interface at that level, I'm just trying to sort out how the pieces fit. And at least the naming of things meant it didn't quite fit well in my head.12:08
wallyworld_i did struggle with the naming12:08
wallyworld_the auth client needs to provide Authernticate(), UserId(), Token() etc12:09
wallyworld_and the non auth client needs to provide noops for those if we want to allow the same client interface to be used everywhere12:10
wallyworld_unless I cast when needed12:10
wallyworld_which I can do12:10
jamwallyworld_: since we won't have any of that actual data, it seems like we should be doing it differently.12:11
jamwe shouldn't return fake data for each one.12:11
jamlike, if we don't have an authenticator, we try to do the request without authentication12:11
jamvs we have one that may just not have auth'd yet12:11
wallyworld_i was trying to avoid type casts but i think i will need to do that12:11
wallyworld_i'll rework it and resubmit12:11
jamc.auth != nil doesn't need a type cast :)12:12
wallyworld_i wasn't 100% happy with the result, but I was happy that it all worked12:12
wallyworld_no not there, in other places12:12
wallyworld_like tests12:12
wallyworld_but let me rework it - the 2nd version should be better12:13
Aram> go doesn't support virtual methods12:13
wallyworld_yeah i know :-(12:13
Aramwhat? dynamic dispatch is an extremely used idiom in Go.12:13
jamAram: go doesn't support subclassing in the standard sense12:13
jamis I think more what he was talking about12:14
wallyworld_methods are staically bound to classes12:14
Aramuse an interface.12:14
wallyworld_it's a limitation Java and C++ refugees initially have to learn to deal with12:14
wallyworld_yes, the zgo idiom is an interface but sometimes it would be easier not to have to do that12:15
Aramyou don't have to do anything. you define an interface and type i := c somewhere instead of typing C implements I somewhere else.12:15
wallyworld_you do have to rearrange your business logic sometimes12:16
wallyworld_if you are used to virtual methods and expect a subclass to invoke the right method, you need to extract the business logic when you discover it doesn't work12:17
wallyworld_to get it off the class and into an interface created just because virtual methods aren't supported12:17
Arami.m() always invokes the right method if you set up i correctly (equivalent to setting a subclass correctly)12:17
Arams/ui i/it up/12:18
wallyworld_yes, but it's a different arrangement of business logic and sometimes it means that stuff which belongs together on a class has to be split12:18
wallyworld_because of non support for virtual methods12:19
wallyworld_it's not such a big issue, just different to other languages which support such things12:19
Aramhave to go buy some bread.12:19
Aramrogpeppe: ^ ^12:19
jamwallyworld_: if you can set the MP to WIP (I can do it, but I'd rather not do that to other people's MPs)12:19
wallyworld_jam: sure, thanks for the input, i'm glad you brought up the same issues i was having when i hit submit :-)12:20
jamwallyworld_: I'm glad you felt the same way, too. :)12:20
wallyworld_jam: yeah, it was EOD and I just wanted to feel i had something done, so i thought it would be worth getting input12:21
rogpeppejam, wallyworld: i'll have a look at this12:21
wallyworld_rogpeppe: thanks, although i'm setting it back to wip to clean up some stuff, so don't look too hard just yet12:22
rogpeppejam: in my experience, when these kinds of issues are resolved, the result is better structured.12:22
rogpeppes/jam/wallyworld/ :-)12:22
wallyworld_which issues? the virtual method dicussion?12:23
rogpeppewallyworld_: yes12:23
rogpeppewallyworld_: presumably we're talking about https://codereview.appspot.com/6962052/ here?12:23
rogpeppewallyworld_: (i haven't looked at it yet)12:24
wallyworld_yes12:24
wallyworld_i do like virtual methods, but if they are no supported, then stuff needs to be done differently12:24
rogpeppewallyworld_: i'm not sure what you mean. all interface methods are virtual12:26
wallyworld_i mean on classes12:27
wallyworld_stucts12:27
wallyworld_structs12:27
rogpeppewallyworld_: ah, you mean a class hierarchy isn't supported. that's true.12:27
wallyworld_yeah, so logic in a bases class calls method foo() and if it is a subclass, the subclass's foo() get invoked12:28
wallyworld_since that's not supported, you are forced to rip logic out of a class where it might be considered to belong12:28
wallyworld_and put it elsewhere12:28
rogpeppewallyworld_: this is actually a good thing, although it's probably difficult to see that currently...12:30
wallyworld_yeah, difficult to see :-) since if everything else does it, it can't be that bad :-)12:30
rogpeppewallyworld_: each type does what it does completely.12:31
wallyworld_and it causes issues when you loose access to class state when the logic is removed12:31
wallyworld_it's not necessarily bad, just different12:31
rogpeppewallyworld_: in the end, IMHO, you get a better separation of concerns and more modular code.12:31
wallyworld_i'll take your word for it, i'm still to come around to that way of thinking :-) not enough Go experience yet12:32
wallyworld_i guess many people new to go have to unlearn past habits12:33
rogpeppewallyworld_: it's certainly a different way of thinking. i think perhaps the crux is moving from thinking, when designing, "what *is* this?" to "what does this *do*?"12:34
rogpeppewallyworld_: Go doesn't do "is a" relationships, other than when implementing interfaces12:34
wallyworld_sure, i guess at the moment i don't see that "what does this do" way of thinking is mutually exclusive to having virtual methods. but maybe i'll get there12:35
wallyworld_i'm actually having more of an issue with go's dependency version management12:36
rogpeppewallyworld_: AFAICS, virtual methods are about defining something that is *almost* something else (but for the virtual methods).12:36
rogpeppewallyworld_: yes, that's unfortunate - i have an idea for a little tool that might help with that.12:37
wallyworld_rogpeppe: it seems that many go people will defend the current state of affairs with go get etc, even though it just seems so wrong12:38
wallyworld_mixing what you are importing with the version you are import in the url which is then spread through every source file seems crazy to me12:39
wallyworld_violates the dry principal big time12:39
rogpeppewallyworld_: i'm not sure. it doesn't seem too different from having the version in some metadata file somewhere in the same source tree12:40
wallyworld_big difference - you change the meta file in one place12:40
wallyworld_not update each and every import12:40
rogpeppewallyworld_: sure, it's repeated info, but what if it was a single two-word command to change all the paths (and check consistency)?12:40
wallyworld_it introduces revision noise for starters12:41
rogpeppewallyworld_: in the CL diffs?12:41
wallyworld_yes, and source revision history12:41
rogpeppewallyworld_: i'm not sure that's a big issue. you're going to have a revision change there anyway (for the metadata) - the only question is the size of the diff.12:42
wallyworld_when reviewing or looking at past revisions, any excess noise distracts from trying to get to the heart of any changes12:43
wallyworld_and why repeat something all throughout the source code?12:44
rogpeppewallyworld_: because it makes the version dependency clear in every piece of code that has it?12:44
rogpeppewallyworld_: i agree it's verbose, but i'm not sure that i see a better alternative currently.12:45
wallyworld_that is true but i feel the cost outweighs the benefit12:45
wallyworld_there's lots of better alternatives :-)12:45
wallyworld_other languages/environments have solutions used successfully12:46
rogpeppewallyworld_: there are quite a few benefits from having the package path as a universal currency that works independently of anything else.12:47
wallyworld_perhaps if it weren't copy and pasted throughout the source code12:47
rogpeppewallyworld_: honestly, i think that's a benefit. each piece of source code completely describes its own dependencies.12:48
wallyworld_each peice of source code doesn't need to do that though - it's surperfulous boiler plate12:49
wallyworld_humans make mistakes and i would be surprised if someone didn't miss changing one import somewhere, or worse, 2 people committed at around the same time with different imports12:49
wallyworld_since the imports are repeated, someone might write a new source file with the "old" import version12:50
wallyworld_and commit that not realising someone else has committed a change which updates the imports elsewhere12:50
rogpeppewallyworld_: ok, here's my plan for a tool12:50
rogpeppewallyworld_: called, say, godep12:51
rogpeppewallyworld_: usage: godep pkg....12:51
rogpeppewallyworld_: it will look in all the source files under the current directory, and find any that have a version-independent matching package path12:52
rogpeppewallyworld_: and change it to the specified package path12:52
dimiternwallyworld_, jam, etc. PTAL - just some comments and improved docs -  https://codereview.appspot.com/696805112:52
rogpeppewallyworld_: where a versioned package path is defined to be anything with an intermediate path name matching v[0-9]+12:52
rogpeppes/intermediate path name/intermediate path element/12:53
wallyworld_rogpeppe: so the first time it is run, version independent paths get changed, but what about the next time?12:53
rogpeppewallyworld_: it will also check all dependencies and make sure that they all import the same version12:53
* dimitern >> lunch12:53
rogpeppewallyworld_: all paths are versioned12:53
rogpeppewallyworld_: just that labix.org/v2/mgo will match labix.org/v3/mgo, for example12:54
wallyworld_ah ok12:54
rogpeppeactually, govers was the name i was thinking of originally12:54
wallyworld_rogpeppe: that all sounds reasonable. it's the go equivalent of editing versions.cfg and changing mgo v2 to mgo v3 and comitting :-)12:55
rogpeppewallyworld_: so then, to make juju-core use a new version of goose, you'd cd to juju-core root, and do govers launchpad.net/goose/v212:55
rogpeppewallyworld_: yes, but without the commit12:56
wallyworld_right12:56
wallyworld_rogpeppe: late here, off to bed, thanks for the interesting discussion. too bad it wasn't at a pub over some beers12:58
rogpeppewallyworld_: too right12:58
wallyworld_next UDS maybe :-)12:58
rogpeppewallyworld_: lets!12:58
rogpeppewallyworld_: sweet dreams :-)12:58
wallyworld_be warned, i start dancing on the table after i have 1 or 2 pints12:58
rogpeppewallyworld_: lol12:59
rogpeppeAram, dimitern, fwereade_: i'd be interested to know what you think of the above idea13:30
hazmatrogpeppe, would you have any time today or tomorrow to discuss api14:58
rogpeppehazmat: definitely14:58
rogpeppehazmat: could do it now if you'd like14:59
hazmatrogpeppe, sounds good14:59
rogpeppehazmat: https://plus.google.com/hangouts/_/2887f22fb3213cc9e9ccd07cd3569c8e06a255ee?authuser=0&hl=en-GB15:00
fwereade__rogpeppe, I hate to be a bore, but I think that https://codereview.appspot.com/6944058/ is uncontroversial in the light of our discussions online, and so I hope it should be an easy re-review17:01
rogpeppefwereade__: ok. i thought you were on hols! :-)17:02
rogpeppefwereade__: am on it17:02
fwereade__rogpeppe, I am, but, y'know -- laura is painting, cath's out buying booze, I am otherwise at a loose end ;p17:02
rogpeppefwereade__: here's a little one for you (preparatory to losing flags from jujud): https://codereview.appspot.com/6972048/17:03
fwereade__rogpeppe, cool17:03
fwereade__rogpeppe, except that CL apparently does not exist17:03
rogpeppefwereade__: oh bugger, one mo17:04
rogpeppefwereade__: https://codereview.appspot.com/6963050/17:04
rogpeppefwereade__: (i proposed it against a badly named branch originally)17:04
rogpeppefwereade__: LGTM17:08
fwereade__rogpeppe, thanks -- and likewise :)17:09
fwereade__rogpeppe, I won;t merge it for a bit yet, so go ahead with yours if it's convenient17:09
rogpeppefwereade__: it's fine - i'm actually knocking up a quick tool to try to ease the goose versioning pains17:10
rogpeppefwereade__: i'd be interested in your views on the idea actually17:10
* rogpeppe is off for the night.18:33
rogpeppeg'night anyone who's around18:33
arosalesjcastro_: ping20:03
hazmatarosales, aren't you on holiday20:13
arosaleshazmat:  sudo holiday :-)20:16
jcastro_that should be pseudo holiday, heh20:49

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!