[go-nuts] Re: import paths - slash vs backslash

2018-02-19 Thread 'Tim Hockin' via golang-nuts
Pinging this topic - does anyone know? On Fri, Nov 10, 2017 at 10:30 AM, Tim Hockin wrote: > Is it valid to say `import "github.com\foo\bar" (windows path > separators) or must it be "github.com/foo/bar"? I couldn't find a > canonical answer to this. > > Thanks > > Tim -- You received this mes

[go-nuts] go install touches the result file even if no changes

2019-01-25 Thread 'Tim Hockin' via golang-nuts
Example: ``` $ which git-sync $ go install -installsuffix "static" ./cmd/git-sync/ $ ls -l --full-time `which git-sync`; md5sum `which git-sync` -rwxr-xr-x 1 thockin primarygroup 13956902 2019-01-25 13:04:40.758632955 -0800 /usr/local/google/home/thockin/src/go/bin/git-sync 1200f479c8ba86f70f0e4

Re: [go-nuts] go install touches the result file even if no changes

2019-01-25 Thread 'Tim Hockin' via golang-nuts
use, maybe I am limited in my imagination). Even Does it really matter if some corner cases result in spurious updates? On Fri, Jan 25, 2019 at 3:02 PM Ian Lance Taylor wrote: > > On Fri, Jan 25, 2019 at 1:07 PM 'Tim Hockin' via golang-nuts > wrote: > > > > Example:

Re: [go-nuts] go install touches the result file even if no changes

2019-01-25 Thread 'Tim Hockin' via golang-nuts
unning "go tool > buildid PROGRAM". See https://golang.org/cmd/buildid. > > Ian > > > > > On Fri, Jan 25, 2019 at 3:02 PM Ian Lance Taylor > wrote: > > > > > > On Fri, Jan 25, 2019 at 1:07 PM 'Tim Hockin' via golang-nuts > >

Re: [go-nuts] go install touches the result file even if no changes

2019-01-26 Thread 'Tim Hockin' via golang-nuts
d. Happy to talk about what we do today to be as on-demand as possible. > On Sat, 26 Jan 2019 at 03:56, 'Tim Hockin' via golang-nuts > wrote: > > > > Fair point, of course. > > > > I care because Kubernetes and it's family of projects have Makefiles to

Re: [go-nuts] go install touches the result file even if no changes

2019-01-28 Thread 'Tim Hockin' via golang-nuts
Of course you are right, as usual. I just felt like that was a lot of hoop-jumping. People already chide me for my affinity for baroque Makefiles... On Sat, Jan 26, 2019 at 11:01 AM Ian Lance Taylor wrote: > > On Fri, Jan 25, 2019 at 7:55 PM Tim Hockin wrote: > > > > Fair point, of course. > >

Re: [go-nuts] go install touches the result file even if no changes

2019-01-28 Thread 'Tim Hockin' via golang-nuts
If you want to see why people give me a hard time: https://github.com/kubernetes/kubernetes/blob/master/build/root/Makefile.generated_files And that's AFTER a massive simplification. On Mon, Jan 28, 2019 at 11:55 AM Ian Lance Taylor wrote: > > On Mon, Jan 28, 2019 at 11:44 AM Tim Hockin wrote:

[go-nuts] import paths - slash vs backslash

2017-11-10 Thread 'Tim Hockin' via golang-nuts
Is it valid to say `import "github.com\foo\bar" (windows path separators) or must it be "github.com/foo/bar"? I couldn't find a canonical answer to this. Thanks Tim -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group

[go-nuts] `go test -i` considered helpful?

2016-09-01 Thread 'Tim Hockin' via golang-nuts
I was running tests against a new project, and it was really slow. When I ran with -x I saw a bunch of build steps that didn't seem to be necessary. Spelunking through docs, reveals that `go test` doesn't install artifacts. `go test -i` does install artifacts but doesn't run the tests. So I chan

Re: [go-nuts] `go test -i` considered helpful?

2016-09-01 Thread 'Tim Hockin' via golang-nuts
What's weird to me is that go test -i doesn't actually run tests. Maybe go test -I which does both? On Sep 1, 2016 11:41 AM, "Ian Lance Taylor" wrote: > On Thu, Sep 1, 2016 at 11:24 AM, 'Tim Hockin' via golang-nuts > wrote: > > I was running tests aga

[go-nuts] runtime.Caller ->

2016-08-14 Thread 'Tim Hockin' via golang-nuts
I was playing with a method that wants to print the file:line of the caller. `runtime.Caller(1)` seems like it should do the trick, but I get ':2'. If I call `runtime.Caller(2)` instead it seems to work, but I don't know why, so I am reluctant to depend on that. Can anyone enlighten me? How can

Re: [go-nuts] runtime.Caller ->

2016-08-14 Thread 'Tim Hockin' via golang-nuts
It is, in fact, a method on an embedded type. That means I can document it and it ceases to be a magic number! Thanks. On Aug 14, 2016 12:27 PM, "Ian Lance Taylor" wrote: > On Sun, Aug 14, 2016 at 11:10 AM, 'Tim Hockin' via golang-nuts > wrote: > > I was pla

Re: [go-nuts] runtime.Caller ->

2016-08-14 Thread 'Tim Hockin' via golang-nuts
, a method on an embedded type. That means I can document it > and it ceases to be a magic number! Thanks. > > > On Aug 14, 2016 12:27 PM, "Ian Lance Taylor" wrote: >> >> On Sun, Aug 14, 2016 at 11:10 AM, 'Tim Hockin' via golang-nuts >> wrote:

Re: [go-nuts] runtime.Caller ->

2016-08-14 Thread 'Tim Hockin' via golang-nuts
On Sun, Aug 14, 2016 at 8:31 PM, Ian Lance Taylor wrote: > On Sun, Aug 14, 2016 at 3:33 PM, Tim Hockin wrote: >> Edit: It looks like this has more to do with being an interface >> method than an embedded type. >> >> https://play.golang.org/p/I5XPdWR_O0 > > Hmmm, you're right. It only happens fo

Re: [go-nuts] runtime.Caller ->

2016-08-14 Thread 'Tim Hockin' via golang-nuts
Can I rely on "" not changing? On Sun, Aug 14, 2016 at 9:55 PM, Ian Lance Taylor wrote: > On Sun, Aug 14, 2016 at 9:41 PM, Tim Hockin wrote: >> On Sun, Aug 14, 2016 at 8:31 PM, Ian Lance Taylor wrote: >>> On Sun, Aug 14, 2016 at 3:33 PM, Tim Hockin wrote: Edit: It looks like this has mor

Re: [go-nuts] runtime.Caller ->

2016-08-15 Thread 'Tim Hockin' via golang-nuts
OK, is there ANY heuristic I can rely on find the "real" call frame? On Mon, Aug 15, 2016 at 10:17 AM, Ian Lance Taylor wrote: > On Sun, Aug 14, 2016 at 10:07 PM, Tim Hockin wrote: >> Can I rely on "" not changing? > > I'm sorry, that's a hard question to answer, because other compilers > do not

[go-nuts] timer Reset concurrent to receive

2017-01-25 Thread 'Tim Hockin' via golang-nuts
I'm not convinced that the docs quite cover the case I am looking, so I am posting here. https://golang.org/pkg/time/#Timer.Reset says "This should not be done concurrent to other receives from the Timer's channel" but it's not clear what the repercussions are. In our case, I have a function to b

Re: [go-nuts] timer Reset concurrent to receive

2017-01-25 Thread 'Tim Hockin' via golang-nuts
Thanks! That makes sense. Does it make sense to update the docs to show the "select-with-default" mode of draining the channel instead? On Wed, Jan 25, 2017 at 10:20 AM, Ian Lance Taylor wrote: > On Wed, Jan 25, 2017 at 9:34 AM, 'Tim Hockin' via golang-nuts > wrote:

Re: [go-nuts] timer Reset concurrent to receive

2017-01-25 Thread 'Tim Hockin' via golang-nuts
e is still a potential race with the > other receive. I mean, we can make the docs arbitrarily complicated, > but at some point it should be on the wiki or something. > > Ian > >> On Wed, Jan 25, 2017 at 10:20 AM, Ian Lance Taylor wrote: >>> On Wed, Jan 25, 2017 at 9:34 A

Re: [go-nuts] timer Reset concurrent to receive

2017-01-25 Thread 'Tim Hockin' via golang-nuts
ith the >>> other receive. I mean, we can make the docs arbitrarily complicated, >>> but at some point it should be on the wiki or something. >>> >>> Ian >>> >>>> On Wed, Jan 25, 2017 at 10:20 AM, Ian Lance Taylor wrote: >>>>>

[go-nuts] 1.8 plugins and ABI

2017-02-23 Thread 'Tim Hockin' via golang-nuts
Hi all, I can't seem to find this documented, and I'm me involved in some conversations about using plugins: What guarantees or limitations surround plugins? Can I compile a host program with go-1.8.0 and have a third-party plugin compiled with 1.8.1, and load it? Can I call methods on plugin-s

Re: [go-nuts] 1.8 plugins and ABI

2017-02-23 Thread 'Tim Hockin' via golang-nuts
Thanks, Ian. Very informative if somewhat disappointing. It more or less rules out what we wanted to do. On Feb 23, 2017 5:23 PM, "Ian Lance Taylor" wrote: On Thu, Feb 23, 2017 at 4:45 PM, 'Tim Hockin' via golang-nuts wrote: > > I can't seem to find this doc

[go-nuts] `go list` across multiple modules?

2020-12-22 Thread 'Tim Hockin' via golang-nuts
I just can't figure out how to do this. Maybe it can't be done in `go list` ? Or maybe we're just missing some detail of go modules.. I have a repo (kubernetes, but minimized at https://github.com/thockin/go-list-modules) which has a "main" go module, and several other modules in the same repo.

Re: [go-nuts] `go list` across multiple modules?

2020-12-23 Thread 'Tim Hockin' via golang-nuts
Hi Paul! On Wed, Dec 23, 2020 at 4:23 AM Paul Jolly wrote: > > > I just can't figure out how to do this. Maybe it can't be done in `go > > list` ? Or maybe we're just missing some detail of go modules.. > > go list operates in the context of a single module (in the mode you > are interested in)

Re: [go-nuts] `go list` across multiple modules?

2021-01-15 Thread 'Tim Hockin' via golang-nuts
Hi. This isn't exactly burning urgent, but it is a long-term issue for Kubernetes. If there's anything I can do to catalyze the discussion - tests to run, info to dig up, etc - please let me know. On Wed, Dec 23, 2020 at 10:48 AM Tim Hockin wrote: > > Hi Paul! > > On Wed, Dec 23, 2020 at 4:23 A

Re: [go-nuts] `go list` across multiple modules?

2021-01-15 Thread 'Tim Hockin' via golang-nuts
anged (mtime is a good enough proxy) and I don't know a priori which packages need codegen. I want to scan the file tree, find the files that need codegen, check their deps, and only then run the codegen. We do this today with `go list` and GO111MODULE=off, but I was advised at some point t

Re: [go-nuts] `go list` across multiple modules?

2021-01-19 Thread 'Tim Hockin' via golang-nuts
thing to use if it gives the information you need. >> >> Yeah, I noticed. When GO111MODULE=off, everything I am doing is much >> faster. I'm wary of depending on that forever, though. >> >> Stepping back, I fear I am pushing the square peg into a round hole. >>

Re: [go-nuts] `go list` across multiple modules?

2021-01-19 Thread 'Tim Hockin' via golang-nuts
ttps://example.com/m/staging/src/example.com/other1/used?go-get=1: >>> 404 Not Found >>> ``` >>> >>> It seems that is because the "main" (top-level dir) go.mod has >>> `replace` directives with relative paths, which kubernetes really >>&g

Re: [go-nuts] `go list` across multiple modules?

2021-01-20 Thread 'Tim Hockin' via golang-nuts
odules/submod/used/ >>>>> main module (tmp) does not contain package tmp/submod/used >>>>> ``` >>>>> >>>>> It also fails some cases: >>>>> >>>>> ``` >>>>> (cd /tmp/gomodhack/; go list /

[go-nuts] Trying to use a tool in my build (a friction log)

2021-03-18 Thread 'Tim Hockin' via golang-nuts
First: go version go1.16 linux/amd64 In one of my side-projects, I build a container image. It turns out to be useful to people, but I got a request to put the license files for all code used in the binary into the container. Lawyers, what can you do? So these people sent me a PR to gather the

Re: [go-nuts] Trying to use a tool in my build (a friction log)

2021-03-19 Thread 'Tim Hockin' via golang-nuts
nction, and I might even argue for explicitness. E.g. if I said `go get -mod=vendor` I feel like I am unambiguously asking the tool to fetch the code and put it in ./vendor and update the module files. If I said just `go get` I (not so unambiguously) mean "global" (for me). I find th

Re: [go-nuts] `go list` across multiple modules?

2021-08-11 Thread 'Tim Hockin' via golang-nuts
gt;>>>>> >>>>>> ``` >>>>>> $ (cd /tmp/gomodhack/; go list /tmp/go-list-modules/submod/used/) >>>>>> example.com/m/submod/used >>>>>> >>>>>> $ go list --modfile /tmp/gomodhack/go.mod >>>&g

Re: [go-nuts] `go list` across multiple modules?

2021-08-11 Thread 'Tim Hockin' via golang-nuts
> package which is part of any module in the build list. For example, >>>>>>>> some >>>>>>>> tools list directories in the module cache to find out what package a >>>>>>>> .go >>>>>>>> file belongs to. &

[go-nuts] testing if strconv.Quote() would do change a string, without calling it

2021-10-13 Thread 'Tim Hockin' via golang-nuts
Is there any ready-built function that can tell me whether `strconv.Quote()` would produce a different string than its input, without actually running it? Or is there a clearly documented set of rules one could use to test each rune in a string? I am trying to avoid allocations, and MOST of th

Re: [go-nuts] testing if strconv.Quote() would do change a string, without calling it

2021-10-13 Thread 'Tim Hockin' via golang-nuts
ote that started at a specified index. > > On Oct 13, 2021, at 5:46 PM, 'Tim Hockin' via golang-nuts < > golang-nuts@googlegroups.com> wrote: > > Is there any ready-built function that can tell me whether > `strconv.Quote()` would produce a different string than

Re: [go-nuts] testing if strconv.Quote() would do change a string, without calling it

2021-10-13 Thread &#x27;Tim Hockin&#x27; via golang-nuts
imple loop calling IsPrint is your best bet. You could then have a >> custom implementation of Quote that started at a specified index. >> >> On Oct 13, 2021, at 5:46 PM, 'Tim Hockin' via golang-nuts < >> golang-nuts@googlegroups.com> wrote: >> >&g

Re: [go-nuts] testing if strconv.Quote() would do change a string, without calling it

2021-10-13 Thread &#x27;Tim Hockin&#x27; via golang-nuts
Thanks for confirming. I wrote that function and erased a good bit of the overhead. bytes.Buffer for the no-escapes path and strconv.Quote otherwise. On Wed, Oct 13, 2021, 8:49 PM Ian Lance Taylor wrote: > On Wed, Oct 13, 2021 at 3:46 PM 'Tim Hockin' via golang-nuts > w

Re: [go-nuts] testing if strconv.Quote() would do change a string, without calling it

2021-10-14 Thread &#x27;Tim Hockin&#x27; via golang-nuts
ith no specials" for i := 0; i < b.N; i++ { out := prettyBuilder(in) foo(out) } } func BenchmarkXXScanAdd(b *testing.B) { in := "a string with no specials" for i := 0; i < b.N; i++ { out := prettyAdd(in) foo(out) } } ``` On

[go-nuts] Using an "internal" repo or org vs. vendor

2022-04-25 Thread &#x27;Tim Hockin&#x27; via golang-nuts
We have some packages we would like to break out into their own repos, but which we don't really want anyone outside of our project to depend on. We could, of course, just document that. But I had this thought that maybe Go's "internal" semantics could be applied here. So as a test, we redirecte

[go-nuts] GOPATH, GOBIN, go install, go build, cross-compiles

2023-01-20 Thread &#x27;Tim Hockin&#x27; via golang-nuts
I'm trying to make kubernetes' codebase easier to navigate by people who have muscle-memory for go. In the past we said "you have to call our Makefile" to build things. I'd like to make \`go install\` work but I'm struggling to find a pattern that really works - am I missing something? First,

Re: [go-nuts] GOPATH, GOBIN, go install, go build, cross-compiles

2023-01-20 Thread &#x27;Tim Hockin&#x27; via golang-nuts
slash or backslash, then any resulting executables > > will be written to that directory. Sure, it's documented, but one mistake and all subsequent invocations fail. It works, but it's just fragile. Tim > On Fri, Jan 20, 2023 at 5:30 PM 'Tim Hockin' via golang-nuts >

[go-nuts] go/types with typedef-of-typedef?

2024-07-25 Thread &#x27;Tim Hockin&#x27; via golang-nuts
Hi all, I have been banging my head on this all day. I am doinking around in some code-generation and find myself deep into the go/types package. Given code like: ``` type E1 string type E2 E1 ``` I loaded the package with x/tools/go/packages. I got the root scope via `pkg.Types.Scope()`.

Re: [go-nuts] Re: go/types with typedef-of-typedef?

2024-07-27 Thread &#x27;Tim Hockin&#x27; via golang-nuts
How do you make the jump from a go/type.TypeName to ast Decl? Is there some easy crosslink? On Fri, Jul 26, 2024, 4:24 PM Jason E. Aten wrote: > To be more specific, > > ast.TypeSpec.Name.Name is, I think, what you are after. > > See https://pkg.go.dev/go/ast#TypeSpec > > And the TypeSpec are f