[go-nuts] How to skip over or fix type-checking errors in the standard library?

2022-05-18 Thread Matt Mueller
Hey Gophers, I'm trying to run the type-checker on some code using "go/types". I got it working for local packages, but I'm stuck on the following when "errors" is imported: ``` could not import errors (errors/wrap.go:8:2: could not import internal/reflectlite (internal/reflectlite/value.go:10

[go-nuts] Tracing across local subprocesses?

2022-02-17 Thread Matt Mueller
Hi there, I was wondering if anyone has a solution for tracing across local subprocesses in Go? Can the standard library do this somehow? OpenTelemetry seems a bit overkill for this use case. Thanks! Matt -- You received this message because you are subscribed to the Google Groups "golang-n

Re: [go-nuts] Anyway to wrap or tweak a test file before running go test?

2021-11-03 Thread Matt Mueller
Hey, thanks. I'm aware of this approach. I'm hoping for some technique that automatically injects, since it can be cumbersome to inject all your dependencies by hand. Similar to google/wire, but without the generated file sitting in the filesystem next to your test. Matt On Wednesday, Nove

[go-nuts] Re: Go on AWS Lambda?

2021-11-03 Thread Matt Mueller
I'd say you pay a bit less for the memory you consume. Generally it runs faster than the more common JS or Python serverless functions, so you also pay less there. I'd argue the main reason to use Go on Serverless is because you'd like to deploy to a Serverless environment and you prefer writin

[go-nuts] Anyway to wrap or tweak a test file before running go test?

2021-11-03 Thread Matt Mueller
I'm looking for a way to inject test dependencies into a test suite. Something like: ``` package user_test func UserTest(t *testing.T, db *postgres.DB) { fmt.Println("running user test", New("Alice Wonderland")) } ``` ``` go_test ./user_test.go ``` Where go_test would either manipulate the f

[go-nuts] What's the BUG in the flag package?

2021-03-24 Thread Matt Mueller
I noticed a lonely BUG comment without an explanation in the flag package: https://github.com/golang/go/blob/master/src/flag/flag.go#L955 I did a quick `git blame` and it goes all the way back to the initial commit: https://github.com/golang/go/commit/ac0dd5ae525db0d057e94c03c3f506bc30afae31.

Re: [go-nuts] What does `go install path/to/main.go` do with GO111MODULE=on?

2021-03-10 Thread Matt Mueller
TC+1 Kurtis Rader wrote: > Do you have environment var GOBIN set? Check the output of "go env GOBIN". > See https://golang.org/ref/mod#mod-commands. > > On Wed, Mar 10, 2021 at 2:59 PM Matt Mueller wrote: > >> Hey folks, >> >> I'm trying to install a c

[go-nuts] What does `go install path/to/main.go` do with GO111MODULE=on?

2021-03-10 Thread Matt Mueller
Hey folks, I'm trying to install a command inside a module globally on my system so that I can use that binary elsewhere. During the $GOPATH era this worked something like this: go install cmd/app/main.go // installed app to $GOPATH/bin Unfortunately that doesn't seem to work anymore. It does

Re: [go-nuts] Can we "go get" unreleased standard library packages?

2020-12-02 Thread Matt Mueller
you just have to wait for go1.16. A beta should be released soon > (probably next week, AIUI). > > > On Thu, Dec 3, 2020 at 12:32 AM Matt Mueller wrote: > >> Hey there, I'd like to try the io/fs package on Go 1.15. Is there an easy >> way to do this? >> >> I t

[go-nuts] Can we "go get" unreleased standard library packages?

2020-12-02 Thread Matt Mueller
Hey there, I'd like to try the io/fs package on Go 1.15. Is there an easy way to do this? I tried without much expectation: go get -u github.com/golang/go/src/io/fs But was greeted with this error: go: found github.com/golang/go/src/io/fs in github.com/golang/go/src v0.0.0-20201202201757-2d02

Re: [go-nuts] Re: Generating code into module cache?

2020-10-21 Thread Matt Mueller
nalysis > running from the repository (like sourcegraph or githubs hover info) might > not understand the code anymore. > >> > >> But, yeah. In general, you can put *any* go code in an appropriate > .zip-file and serve it up as a module. You don't even have to publ

[go-nuts] Re: Generating code into module cache?

2020-10-20 Thread Matt Mueller
Sorry, maybe cache is the wrong word. Wherever "go get -u ..." downloads modules, I'd like to stick my generated code. Conceptually you could think of it as a virtual module used only during development. If you're familiar with Node.js, You could also think of it as creating a directory in no

[go-nuts] Generating code into module cache?

2020-10-20 Thread Matt Mueller
Hey folks, I'm working on a project with a lot of code generation. I'd love to: - get the code generation out of the way when you don't care about it - be able to vendor the generated code when you do care about it That led me to an idea about generating code into the go module cache. Do you s

[go-nuts] Re: Why does x/tools/go/packages use `go list` under the hood?

2020-08-17 Thread Matt Mueller
I think I got it. It looks like `go list` uses an internal cache to make its use really fast. Hopefully this package gets merged into the stdlib and we can take advantage of the cache directly! On Monday, August 17, 2020 at 11:22:52 PM UTC+2 Matt Mueller wrote: > Hi folks, > > I wa

[go-nuts] Why does x/tools/go/packages use `go list` under the hood?

2020-08-17 Thread Matt Mueller
Hi folks, I was looking into where my packages.Load time was being spent and I noticed that under the hood the packages library calls out to "go list" for information. I'm just wondering if there's any specific reason for this? It seems like fairly low-hanging fruit performance-wise to not spa

[go-nuts] Measuring go run and go build times?

2020-07-29 Thread Matt Mueller
I'm working on a dev tool for automatically reloading the server when you change a file. I'd like for the reload time to be as fast as possible. Are there any flags or environment variables that I can set to see where the time is being spent (compiling, linking etc.)? Also seeing what packages

[go-nuts] Choosing thread for goroutine?

2020-07-19 Thread Matt Mueller
Hey folks, I'm working on a server-side Javascript rendering package in Go. It uses https://bellard.org/quickjs/ for it's parser and interpreter. I'm using https://github.com/lithdew/quickjs to package it with Go. Quickjs appears to have some thread-local memory, so I'm use runtime.LockOSThrea

[go-nuts] Safe to treat time.Local != time.LoadLocation("your current timezone")?

2018-10-18 Thread Matt Mueller
Hey folks, I'm trying to ensure that the user must pass a specific location (anything but time.Local) into a function. I'd like to add a check like this: // ensure we didn't pass in an offset the default time.Local if offset.Location() == time.Local { return nil, errors.New("offset use a speci

Re: [go-nuts] Closing os.Stdin while trying to read from it?

2018-03-19 Thread Matt Mueller
Thanks for the great info! Out of curiosity, how is Go handling ctrl+d (sending EOF to stdin) right now? Is it part of the special case? A more generic way to ask this is: Is it possible to programmatically tell os.Stdin that we've reached EOF while you're trying to read from it? On Friday,

[go-nuts] Closing os.Stdin while trying to read from it?

2018-03-15 Thread Matt Mueller
Hey folks, I'm trying to figure out how to cancel reading from stdin programmatically. Basically the same way that ctrl+d works on OSX. I would have thought this would work, but this program will just run forever: package main import ( "io/ioutil" "os" "time" ) func main() { go func()

Re: [go-nuts] Where to stick temporary go files after an AST rewrite?

2017-12-28 Thread Matt Mueller
e > whether the go tool expects all files in a package to be in the same > directory or not. > > The way to call "go run" from Go is to use the os/exec > <http://godoc.org/os/exec#example-Cmd-CombinedOutput> package to > literally run the command. > > On Mon,

[go-nuts] Where to stick temporary go files after an AST rewrite?

2017-12-25 Thread Matt Mueller
Hey folks! I'm using the new https://godoc.org/golang.org/x/tools/go/ast/astutil#Apply function, but keep running into the question: After I rewrite these files, where do I stick them so they're still buildable with the rest of the program? Is there anyway to call "go run" after modifying the

Re: [go-nuts] TCP writes without a corresponding read?

2017-10-23 Thread Matt Mueller
Tuesday, October 24, 2017 at 12:43:21 AM UTC+7, Ian Lance Taylor wrote: > > On Mon, Oct 23, 2017 at 10:25 AM, Matt Mueller > wrote: > > > > Ah thanks guys for the insights, this led me to do some more digging: > > > > http://man7.org/linux/man-pages/ma

Re: [go-nuts] TCP writes without a corresponding read?

2017-10-23 Thread Matt Mueller
Ah thanks guys for the insights, this led me to do some more digging: http://man7.org/linux/man-pages/man2/listen.2.html http://man7.org/linux/man-pages/man2/accept.2.html - Looks like Listen() creates a socket and a backlog queue. - When you call Dial(), the connection request gets stored in tha

[go-nuts] TCP writes without a corresponding read?

2017-10-22 Thread Matt Mueller
Hey everyone! This question cropped up while testing. It's 2 related questions: *1. Why am I able to write to without accepting a connection?* addr, err := net.ResolveTCPAddr("tcp", "127.0.0.1:0") if err != nil { t.Fatal(err) } ln, err := net.ListenTCP("tcp", addr) if err != nil {