Re: [go-nuts] go doc broken in official go repo

2024-07-18 Thread 'Sean Liao' via golang-nuts
the bootstrap version only allows you to build enough of the compiler for it to run and build the rest of the distribution. you should be using the go binary built from the given source tree when interacting with it. - sean On Thu, Jul 18, 2024, 22:25 will@gmail.com wrote: > I cloned the of

Re: [go-nuts] gomobile: weird dependency on dmitri.shuralyov.com/gpu/mtl

2024-07-17 Thread 'Sean Liao' via golang-nuts
x/mobile isn't just for bindings, it also has some support for more full fledged apps, see https://pkg.go.dev/golang.org/x/mobile/app It seems natural to require some rendering support for that. - sean On Wed, Jul 17, 2024 at 4:42 PM Alvaro Crespo wrote: > > Hi! > > Sadly, "go mod why" doesn't r

Re: [go-nuts] net/http: no Client API to close server connection based on Response #21978

2024-04-02 Thread 'Sean Liao' via golang-nuts
since you already know the server is problematic, you could just set Close on the original request. On Tue, Apr 2, 2024, 15:29 Jim Minter wrote: > Hello, > > I was wondering if anyone had any ideas about > https://github.com/golang/go/issues/21978 ("net/http: no Client API to > close server conn

Re: [go-nuts] Failed to compile a generic code using embedded struct

2024-02-26 Thread 'Sean Liao' via golang-nuts
see https://go.dev/issue/51183 - sean On Mon, Feb 26, 2024, 15:44 Albert Widiatmoko wrote: > Hi Go community, > > I was playing with Go generics and writing some codes, but I faced some > problems. I want to ask questions and help from the community if possible. > Below, I am trying to build a

Re: [go-nuts] Could we trade all the `ctx context.Context` arguments for one pointer in `g`?

2024-02-21 Thread 'Sean Liao' via golang-nuts
https://go.dev/issue/21335 - sean On Wed, Feb 21, 2024, 00:36 Sam Vilain wrote: > Alright, well thanks for your input. > > I do think these questions can be answered; exploring the use cases in a > proposal format should hopefully show that the impact of closures would not > normally be an issu

Re: [go-nuts] heap ballast

2024-02-12 Thread 'Sean Liao' via golang-nuts
The modern way to handle this is with GOMEMLIMIT https://tip.golang.org/doc/gc-guide - sean On Mon, Feb 12, 2024 at 8:33 PM Mike Mitchell wrote: > > Purely for the sake of experiment (this is not a production environment > thing), I have tried to test out the Heap Ballast technique of reducing

Re: [go-nuts] Re: 1.22.0 ServeMux HandleFunc infinite loop

2024-02-08 Thread 'Sean Liao' via golang-nuts
I've filed it as https://go.dev/issue/65624 - sean On Thu, Feb 8, 2024 at 6:58 PM Kyle Shannon wrote: > > On 2/8/24 11:30, Jason Phillips wrote: > > Can you create a small self-contained program that reproduces the issue? The > following program returns 404 locally, as I'd expect, but does get

Re: [go-nuts] <-ctx.Done() panic

2024-01-03 Thread &#x27;Sean Liao&#x27; via golang-nuts
maybe a bad custom context implementation in the chain - sean On Wed, Jan 3, 2024, 10:57 cheng dong wrote: > i have a program paniced with > > ``` > runtime.deferCallSave(0xc0313d56d8, 0xc0401839e8?) > /home/ubuntu/go/go1.19.5/src/runtime/panic.go:796 +0x88 > fp=0xc0313d5618 sp=0xc0313d

Re: [go-nuts] https client 403 error

2023-12-29 Thread &#x27;Sean Liao&#x27; via golang-nuts
see https://pkg.go.dev/net/http#Client.Jar - sean - sean On Fri, Dec 29, 2023 at 6:53 PM vlya...@gmail.com wrote: > > I use generic https client code to perform GET: > tr := &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: > true}, } > client := &http.Client{ Transport: tr,

Re: [go-nuts] Re: custom slog Handler which adds Attribute and WithGroup

2023-10-23 Thread &#x27;Sean Liao&#x27; via golang-nuts
The slog API doesn't allow wrapping handlers this way. slog.Handlers hold state for the current open group. You'll need a full implementation of a handler to do this. (Technically it's possible if you record the group/attrs in With/WithGroup yourself and only call the wrapped handler in Handle, bu

Re: [go-nuts] Re: Weird error when trying to fetch a module.

2023-09-15 Thread &#x27;Sean Liao&#x27; via golang-nuts
Modules in subdirectories should just work, tags are not necessary. I see there is a recent commit to correct the module name, that was necessary. As for your most recent invocation, the module path was wrong (missing a /src/ component) $ go get github.com/flatgeobuf/flatgeobuf/src/go@v0.0.0-2023

Re: [go-nuts] Re: [slog] customize defaultHandler

2023-08-29 Thread &#x27;Sean Liao&#x27; via golang-nuts
cycle: https://go.dev//issues/61892 default handler, copied/exported: https://pkg.go.dev/github.com/jba/slog/handlers/loghandler - sean On Tue, Aug 29, 2023 at 7:53 AM Marcello H wrote: > Yesterday, I came up with the same question and found this: > "github.com/lmittmann/tint" > > (This solut

Re: [go-nuts] How to be a good slog module?

2023-08-23 Thread &#x27;Sean Liao&#x27; via golang-nuts
If your modules are mostly structs with lifecycle methods, do it like http.Server where the logger is a field (or option passed into the constructor). Else if your modules take contexts, you could consider having your own WithLogger / FromContext funcs to pass a logger in a context. An advantage

Re: [go-nuts] Re: Using underscore in return statements - a small convenience idea

2023-08-23 Thread &#x27;Sean Liao&#x27; via golang-nuts
see also: https://go.dev/issues/19642 https://go.dev//issues/21182 - sean On Wed, Aug 23, 2023 at 3:10 PM Nick Craig-Wood wrote: > Ah ha! I thought there would be a related issue I couldn't find :-) > > `zero` would remove most of the pain though IMHO `_` looks neater in the > return statemen

Re: [go-nuts] possible bug in slogtest or ReplaceAttr

2023-08-18 Thread &#x27;Sean Liao&#x27; via golang-nuts
please file it as a bug for jsonhandler - sean On Fri, Aug 18, 2023, 21:17 jal...@gmail.com wrote: > Hi all, > > In slog, I am experimenting with the the ReplaceAttr func in the > HandlerOptions with json handler. My understanding is that if i want to > remove an attribute then return an empty

Re: [go-nuts] Is go test the wrong tool to use for a pure test harness?

2023-08-13 Thread &#x27;Sean Liao&#x27; via golang-nuts
you can compile a test binary with `go test -c` and execute it later - sean On Sun, Aug 13, 2023, 18:28 dave bronte wrote: > Forgive me for what might at first glance look like a provocative subject > line - it's not meant to be. > > The team that I work in has been asked to develop a system th

Re: [go-nuts] How to minimize RAM usage during Go binary compilation

2023-07-12 Thread &#x27;Sean Liao&#x27; via golang-nuts
considering it is primarily static information, maybe it should be passed in and as data during run time, instead of being embedded and compiled as code? - sean On Wed, Jul 12, 2023, 13:18 Jason Kulatunga wrote: > Hi, > > I’m doing something a bit unusual with my application and I’m trying to >

Re: [go-nuts] comment.Printer.DocLinkURL isn't being called

2023-07-09 Thread &#x27;Sean Liao&#x27; via golang-nuts
your parsing setup is missing the lookup to identify which things are actually linkable symbols https://go.dev/play/p/sDtGA_JJZdz - sean On Sun, Jul 9, 2023, 23:45 will@gmail.com wrote: > I'm trying to print the Markdown for package documentation using the new > go/doc/comment package. It

Re: [go-nuts] Re: Amateur's questions about "Go lang spec"

2023-06-03 Thread &#x27;Sean Liao&#x27; via golang-nuts
It is not a typo https://go.dev/issue/24451 - sean On Sat, Jun 3, 2023 at 10:05 PM peterGo wrote: > It's a simple typo. Send in a fix. > > peter > > On Saturday, June 3, 2023 at 4:07:15 PM UTC-4 Kamil Ziemian wrote: > >> As burak serdar said, 9 = 3 * 3 is not a prime number, all other element

Re: [go-nuts] Importing a package declared in the root directory of a module

2023-04-15 Thread &#x27;Sean Liao&#x27; via golang-nuts
the import path specifies the location to find a package, but the actual identifier used is the one in the package declaration, so import "a_module_path" var foo = util.Foo - sean On Sat, Apr 15, 2023, 20:40 Victor Giordano wrote: > Thanks *Sean!!* > That makes sense for me! > > But i guess I

Re: [go-nuts] Importing a package declared in the root directory of a module

2023-04-15 Thread &#x27;Sean Liao&#x27; via golang-nuts
import "a_module_path" optionally rename it to make it clearer import util "a_module_path" - sean On Sat, Apr 15, 2023, 20:31 Victor Giordano wrote: > Hi there! > > I was playing a little bit with modules and packages, regarding making > projects. > And I'm struggling to use a package (non-ma

Re: [go-nuts] Is there a golang download for latest patch release like 1.20.x?

2023-03-30 Thread &#x27;Sean Liao&#x27; via golang-nuts
What page are you looking at? https://go.dev/dl/ - sean On Thu, Mar 30, 2023 at 6:17 PM silverwind wrote: > Is there a way to download the latest patch release of golang 1.20 which > currently is at 1.20.2. On the available downloads, I only find explicit > links: > > https://go.dev/dl/go1.20

Re: [go-nuts] Redfining loop variable semantics - what's the plan?

2023-03-24 Thread &#x27;Sean Liao&#x27; via golang-nuts
https://go.dev/issue/57969 - sean On Sat, Mar 25, 2023, 06:45 Amnon wrote: > Hi Gophers, > Last year there was a discussion about removing one of the > more common gotchas in Go. > > To quote from the discussion: > > the problem is that loops like this one don’t do what they look like they > do

Re: [go-nuts] Minor Omission in List on https://pkg.go.dev/golang.org/x

2023-03-10 Thread &#x27;Sean Liao&#x27; via golang-nuts
https://go.dev/issue/56482 - sean On Sat, Mar 11, 2023 at 7:35 AM Ian Lance Taylor wrote: > On Fri, Mar 10, 2023 at 2:54 PM jlfo...@berkeley.edu > wrote: > > > > Shouldn't "term" be included in the list shown on > https://pkg.go.dev/golang.org/x? > > > > Going directly to https://pkg.go.dev/g

Re: [go-nuts] "go test": common prefix for errors

2023-03-10 Thread &#x27;Sean Liao&#x27; via golang-nuts
implementing a helper/wrapper on your side might be easier, I believe most helpers take the TB interface rather than the concrete T type. also it sounds more like a failure of the application to separate its output streams properly. -- You received this message because you are subscribed to the G

Re: [go-nuts] Re: heap profiling does not work on M2 MacBook air?

2023-03-01 Thread &#x27;Sean Liao&#x27; via golang-nuts
fwiw, that code works on my machine :tm: 1:40:47 ~/tmp/testrepo0120 0:00:27 main » go run . 1:40:58 ~/tmp/testrepo0120 0:00:08 main » go tool pprof mem.prof File: testrepo0120 Type: inuse_space Time: Mar 2, 2023 at 1:40am (CST) Entering interactive mode (type "help" for commands, "o" for options)

Re: [go-nuts] Go 1.20 "cold start" slows down CI pipeline stages due to first building stdlib

2023-02-16 Thread &#x27;Sean Liao&#x27; via golang-nuts
- restore cache (go version as cache key) - go build std - save cache (GOCACHE) - original build steps follow here - sean On Thu, Feb 16, 2023, 19:54 TheDiveO wrote: > As Go 1.20 doesn't ship anymore with prebuild stlib packages, the first > build after installation will take longer. Obviously,

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

2023-01-20 Thread &#x27;Sean Liao&#x27; via golang-nuts
rk in combination with GOFLAGS, now that quoting is allowed after https://go.dev/issue/26849 - sean On Fri, Jan 20, 2023 at 7:30 PM Tim Hockin wrote: > Thanks Sean. > > On Fri, Jan 20, 2023 at 10:39 AM 'Sean Liao' via golang-nuts > wrote: > > > > in module mode,

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

2023-01-20 Thread &#x27;Sean Liao&#x27; via golang-nuts
in module mode, GOPATH is really only used for deriving default locations for GOBIN and GOMODCACHE setting it to /dev/null might not be great for caching dependencies if GOMODCACHE isn't set cross compile to GOBIN was recently (re)opened https://go.dev/issue/57485 There are open requests to print

Re: [go-nuts] Is OCSP Stapling supported in Go? If so, how?

2022-12-19 Thread &#x27;Sean Liao&#x27; via golang-nuts
The standard library itself doesn't do it, but it does provide you with hooks to do so. Set crypto/tls.Config.GetCertificate to an appropriate implementation of OCSP stapling. Examples of ocsp stapling can be found via the package discovery site: https://pkg.go.dev/search?q=ocsp+staple - sean On

Re: [go-nuts] the example always fails if the string contains a trailing space before a newline

2022-12-19 Thread &#x27;Sean Liao&#x27; via golang-nuts
https://go.dev/issue/26460 - sean On Mon, Dec 19, 2022 at 7:31 PM David M wrote: > Not quite sure if this is a bug but it's annoying: > > If the example tested string contains a trailing space before a newline, > the test always fails no matter how. > // this test passes > func ExampleFormat()

Re: [go-nuts] Refresher tutorial

2022-12-10 Thread &#x27;Sean Liao&#x27; via golang-nuts
consider something like https://learnxinyminutes.com/docs/go/ if you just need a brief refresher on syntax/core concepts - sean On Sat, Dec 10, 2022, 17:17 Ken wrote: > Hi, when I first learned golang, there was a nice tutorial avaiable. I’m > in need of a refresher as I haven’t used it in quit

Re: [go-nuts] HTTPS proxy issue using CONNECT method

2022-12-03 Thread &#x27;Sean Liao&#x27; via golang-nuts
How are you setting the proxy? - sean On Sat, Dec 3, 2022, 16:46 Mauro Monteiro wrote: > Hello all, > > I have been facing an issue when I try to create a HTTP client which needs > to connect through a HTTPS proxy using the HTTP CONNEC method. I know that > it can be achieved setting my own htt

Re: [go-nuts] go install of forked repo

2022-12-03 Thread &#x27;Sean Liao&#x27; via golang-nuts
`go install pkg@version` doesn't support installing from a fork. The argument is best understood as a module identity rather than source code location. - sean On Sat, Dec 3, 2022, 11:55 Duncan Harris wrote: > This seems a noddy question but can't easily find an answer with Google > apparently.

Re: [go-nuts] Re: gRPC for web applications with millions of users

2022-12-02 Thread &#x27;Sean Liao&#x27; via golang-nuts
See also https://buf.build/blog/connect-web-protobuf-grpc-in-the-browser - sean On Fri, Dec 2, 2022 at 4:46 PM Brian Candler wrote: > Just checking that you came across this already? > https://grpc.io/blog/state-of-grpc-web/ > > gRPC can't be implemented natively in browsers. You can sending s

Re: [go-nuts] Fetch pseudo-versions

2022-12-02 Thread &#x27;Sean Liao&#x27; via golang-nuts
all pseudoversions would be a list of all commits are you sure that's what you want? - sean On Fri, Dec 2, 2022, 16:37 Marco Augusto Vitangeli < marcoaugustovitang...@gmail.com> wrote: > Hi, this question is a little bit weird, but for a project I need to list > all versions of a golang package.

Re: [go-nuts] where is GOROOT set?

2022-11-23 Thread &#x27;Sean Liao&#x27; via golang-nuts
output of `go env` please - sean On Wed, Nov 23, 2022 at 11:25 PM pat2...@gmail.com wrote: > I've separated my code into separate subdirectories, added a go.mod > ran go mod tidy on each. > > I'm mostly back where I started, which a better source file tree > > I'm trying to test the "treesort"

Re: [go-nuts] Re: is this a bug in "go fmt"?

2022-11-11 Thread &#x27;Sean Liao&#x27; via golang-nuts
You'll need to provide more info if you want to report a bug: ``` main » cat main.go // +build production // +build linux package main 21:13:35 ~/tmp/testrepo0017 0:00:00 main » go fmt . main.go 21:13:39 ~/tmp/testrepo0017 0:00:00 main » cat main.go //go:build production && linux // +build prod

Re: [go-nuts] [ANN] Tool for automatic instrumentation of OpenTelemetry

2022-11-10 Thread &#x27;Sean Liao&#x27; via golang-nuts
Interesting As a note, directive comments should be of the form `//toolname:directive`, meaning the `//go:` prefix should be reserved for the `go` toolchain itself. - sean On Thu, Nov 10, 2022 at 4:07 PM Nikolay Dubina wrote: > *What?* > > Tool for automatic instrumentation of OpenTelemetry T

Re: [go-nuts] Re: behavior of %f

2022-10-10 Thread &#x27;Sean Liao&#x27; via golang-nuts
> leaving one with the impression those digits will be as they are in the float, and not rounded. This is a fundamental misunderstanding of what a float is. The rounding happens the moment a value is stored in a float. The printed value is exactly what is stored. - sean -- You received this mes

Re: [go-nuts] Internationalized webpage depending on the user's web browser locale

2022-10-10 Thread &#x27;Sean Liao&#x27; via golang-nuts
.Lang comes from something gitea provided to the template, it's not an intrinsic part of go - sean On Mon, Oct 10, 2022, 19:48 Christoph wrote: > Hello, > > I am running a git-server, powered by gitea, an open-source git server > project written in Go. In gitea, it is possible to customize the

Re: [go-nuts] Error-checking with errors.As() is brittle with regards to plain vs pointer types

2022-09-22 Thread &#x27;Sean Liao&#x27; via golang-nuts
The documented api includes > An error matches target if the error's concrete value is assignable to the value pointed to by target *T is not assignable to T - sean On Wed, Sep 21, 2022, 20:26 cpu...@gmail.com wrote: > Consider https://go.dev/play/p/jgPMwLRRsqe: > > errors.As(err, ) will not

Re: [go-nuts] Detachable context.Context?

2022-09-03 Thread &#x27;Sean Liao&#x27; via golang-nuts
https://go.dev/issue/40221 - sean On Sat, Sep 3, 2022, 16:56 Alex Besogonov wrote: > Hi! > > Let me give you some context. context.Context in Go serves two main > purposes: > 1. Cancellation and timeout support. > 2. A carrier of values, as a de-facto replacement for thread-local > variables. >

Re: [go-nuts] How to cross-compile Go 1.19 compiler for Solaris 11 on Linux

2022-09-01 Thread &#x27;Sean Liao&#x27; via golang-nuts
That's a known issue, see: https://go.dev/issue/53813 https://go.dev/issue/54197 - sean On Wed, Aug 31, 2022, 21:35 Shane wrote: > I was finally able to compile the bootstrap on Linux (I had to install the > missing libc). > > However, after copying the .tbz file onto my Solaris 11u4 AMD64 mac

Re: [go-nuts] How to cross-compile Go 1.19 compiler for Solaris 11 on Linux

2022-08-27 Thread &#x27;Sean Liao&#x27; via golang-nuts
make.bash calls cmd/dist which does the build chaining, calling it directly doesn't skip the process. - sean On Sat, Aug 27, 2022, 19:54 Shane wrote: > > Is there some way I can skip straight to building Go for my Solaris > target using my existing Linux Go tools? > Sorry, this question was fo

Re: [go-nuts] How to cross-compile Go 1.19 compiler for Solaris 11 on Linux

2022-08-27 Thread &#x27;Sean Liao&#x27; via golang-nuts
The bootstrap process is a chain of builds that each build the next stage, to minimize any effects of the host system, in order to produce a consistent final artifact. Your builds are failing before it has successfully built the final host stage, cross compiling hasn't come into the picture yet. Wh

Re: [go-nuts] Client Cipher Order Preference not being honored with golang 1.17+

2022-08-26 Thread &#x27;Sean Liao&#x27; via golang-nuts
grade on >> SSLLabs <https://ssllabs.com/>. >> >> On Thu, Aug 25, 2022 at 1:20 PM 'Sean Liao' via golang-nuts < >> golan...@googlegroups.com> wrote: >> >>> This is intentional, see https://go.dev/issue/45430 >>> >>> -

Re: [go-nuts] Client Cipher Order Preference not being honored with golang 1.17+

2022-08-25 Thread &#x27;Sean Liao&#x27; via golang-nuts
This is intentional, see https://go.dev/issue/45430 - sean On Thu, Aug 25, 2022, 19:07 'Diana Tuck' via golang-nuts < golang-nuts@googlegroups.com> wrote: > Since upgrading to 1.17 in which the cipher order is determined by the > golang lib, clients that previously negotiated with more secure ci

Re: [go-nuts] Go multiplexers

2022-08-20 Thread &#x27;Sean Liao&#x27; via golang-nuts
yamux uses its own protocol, it doesn't speak telnet - sean On Sat, Aug 20, 2022, 21:31 ramki...@hotmail.com wrote: > Has anyone ever used a multiplexer ? > When creating a TCP server using multiplexer, I get an error [ERR] yamux: > Invalid protocol version:

Re: [go-nuts] Re: Generic error handling with panic, recover, and defer

2022-07-29 Thread &#x27;Sean Liao&#x27; via golang-nuts
or https://github.com/dsnet/try - sean On Fri, Jul 29, 2022, 23:01 Nathaniel Lehrer wrote: > This is similar, maybe this one is better to use? > https://github.com/lainio/err2 > > On Tuesday, September 21, 2021 at 1:57:38 PM UTC-7 mces...@gmail.com > wrote: > >> With go 1.18 generics implementa

Re: [go-nuts] ListenAndServeTLS() (pem and key files for private network)

2022-06-30 Thread &#x27;Sean Liao&#x27; via golang-nuts
> using a self-signed certificate > without the browser complaining that the certificate is invalid By default, browsers trust certificates signed by Certificate Authorities (CA) in the system cert store. CAs can get added if they pass certain requirements. Typically they will only sign certifica

Re: [go-nuts] Query regarding net/http/cookiejar: Cookies() method and Expiry/MaxAge

2022-06-29 Thread &#x27;Sean Liao&#x27; via golang-nuts
Implement your own cookie jar, See also: https://github.com/golang/go/issues/19291#issuecomment-282576908 - sean On Wed, Jun 29, 2022 at 11:31 PM Amit Saha wrote: > Hi all, > > Currently the Cookies() method as explained at > https://pkg.go.dev/net/http/cookiejar#Jar.Cookies only adds the Nam

Re: [go-nuts] defer func running timing

2022-06-25 Thread &#x27;Sean Liao&#x27; via golang-nuts
Maybe it's clearer if you look at what's happening like this https://go.dev/play/p/jAia9OPJfbY The arguments to defer are evaluated immediately, but the execution only happens later - sean On Sat, Jun 25, 2022, 21:40 Lee Chou wrote: > Hello, > > https://go.dev/play/p/J1tVplkIrjt > > why o1.Ref

Re: [go-nuts] godoc and 1.19 "Doc links"

2022-06-25 Thread &#x27;Sean Liao&#x27; via golang-nuts
I believe the answer is using godoc That would be a correct link if you used pkgsite godoc is deprecated as of https://github.com/golang/go/issues/49212 - sean On Sat, Jun 25, 2022, 20:54 TheDiveO wrote: > Using go1.19beta1 I installed godoc using "go1.19beta1 install > golang.org/x/tools/cmd/

Re: [go-nuts] How does Go runtime decide minimum number of threads?

2022-06-20 Thread &#x27;Sean Liao&#x27; via golang-nuts
from runtime: > The GOMAXPROCS variable limits the number of operating system threads that can execute user-level Go code simultaneously. There is no limit to the number of threads that can be blocked in system calls on behalf of Go code; those do not count against the GOMAXPROCS limit. - sean O

Re: [go-nuts] Help with sync.Cond failing to signal

2022-06-11 Thread &#x27;Sean Liao&#x27; via golang-nuts
sync.Cond does not affect goroutine scheduling priority, and Signal only makes the waiting goroutine available to be scheduled, but not force it to be. After a Signal() (and Unlock()), every other waiting worker and the flusher then contends (fairly) for the lock. What you want appears a better fit

Re: [go-nuts] unrecognized import path "code.google.com/p/go.crypto/openpgp"

2022-06-10 Thread &#x27;Sean Liao&#x27; via golang-nuts
Note that x/crypto/openpgp has been frozen and deprecated, you're better off with a third party maintained package - sean On Fri, Jun 10, 2022, 00:41 'Dan Kortschak' via golang-nuts < golang-nuts@googlegroups.com> wrote: > On Thu, 2022-06-09 at 14:21 -0700, Peter Sjolin wrote: > > I attempted to

Re: [go-nuts] Functions vs Methods: explain reasoning behind STD

2022-06-02 Thread &#x27;Sean Liao&#x27; via golang-nuts
Namespacing, aesthetics, and interfaces If, for whatever reason, you don't like the way method calls look, you can use: var a net.TCPAddr _ = a.Family() // usual method call _ = net.TCPAddr.Family(&a) // equivalent to above If everything was a pure function, it'd look much like the se

Re: [go-nuts] uber handler to collect stacktrace when program crashing

2022-05-28 Thread &#x27;Sean Liao&#x27; via golang-nuts
I believe this is asking for a single handler that will apply to all goroutines, to which the answer is no such feature exists - sean On Sat, May 28, 2022, 03:09 Ian Lance Taylor wrote: > On Fri, May 27, 2022 at 10:42 AM Aggarwal Sre > wrote: > > > > Is there a recommended pattern besides addi

Re: [go-nuts] Re: Installing a package with an associated command

2022-05-25 Thread &#x27;Sean Liao&#x27; via golang-nuts
`go install github.com/your/repo/cmd/...@latest` should work replace `latest` with specific versions (eg prereleases) if necessary - sean On Wed, May 25, 2022, 08:50 christoph...@gmail.com < christophe.mees...@gmail.com> wrote: > Indeed, it works. What if there are multiple binaries to install

Re: [go-nuts] encoding/json doesn't find marshal/unmarshal via type aliases

2022-05-20 Thread &#x27;Sean Liao&#x27; via golang-nuts
As explained above, `type AliasedDate Date` clears any methods you have defined on `Date`. But `Date` embeds `time.Time` which has its own `UnmrshalJSON`, which now gets promoted. So `Date.UnmsrshalJSON` calls your `UnmsrshalJSON` `AliastedDate.UnmsrshalJSON` calls `AliastedDate.Time.UnmsrshalJSON

Re: [go-nuts] OAuth2 HttpClient customizable header

2022-05-18 Thread &#x27;Sean Liao&#x27; via golang-nuts
Now that I think about it, it won't work because oauth2 will Set the Authorization header, overwriting whatever you might have originally set there. Maybe it's easier to follow standard oauth and move the original user authentication into some other header? On Wed, May 18, 2022 at 8:50 PM 'Patri

Re: [go-nuts] OAuth2 HttpClient customizable header

2022-05-18 Thread &#x27;Sean Liao&#x27; via golang-nuts
doesn't sound like a common use case, might be easier to use a transport that moves the header? - sean On Wed, May 18, 2022, 19:52 'Patrick Kaeding' via golang-nuts < golang-nuts@googlegroups.com> wrote: > Would it be possible to allow the [header that is used]( > https://github.com/golang/oauth

Re: [go-nuts] Crypto/tls: Get further information on established TLS connection

2022-05-09 Thread &#x27;Sean Liao&#x27; via golang-nuts
tls.Conn.ConnectionState().PeerCertificates - sean On Mon, May 9, 2022, 16:59 J. Pecholt wrote: > Hi there, > I am trying to perform further authentication operations based on an > existing tls.Conn without modifying the package/module itself because of > portability and security reasons. More

Re: [go-nuts] Refactor to use generics to have a single Make

2022-05-03 Thread &#x27;Sean Liao&#x27; via golang-nuts
right now it only works if the structs are actually identical: https://go.dev/play/p/tMG3SYG5fLN - sean On Tue, May 3, 2022 at 8:06 PM sbezverk wrote: > Hello, > > > > I am starting to learn generics and I was wondering if the following code > could be refactored to use genercis, in order to a

Re: [go-nuts] Re: testing examples printing to stdout not working for global var

2022-05-02 Thread &#x27;Sean Liao&#x27; via golang-nuts
Code needs to be written to be testable. Peter is correct, you've taken a reference to an uninstrumented os.Stdout. What you've written isn't identical wrt to the evaluation of stdout, so can't be expected to perform identically. -- You received this message because you are subscribed to the Goog

Re: [go-nuts] What is the Go build cache for fuzz testing?

2022-04-27 Thread &#x27;Sean Liao&#x27; via golang-nuts
testdata/fuzz is for inputs that have caused a failure and you want to keep around so that they are ~always run, to prevent regressions. -fuzzcache is more like a log of useful things it has tried, so it doesn't waste resources going over the same/similar inputs see `go help cache` - sean On Wed

Re: [go-nuts] Advice for closed network - problem with go mod

2022-04-25 Thread &#x27;Sean Liao&#x27; via golang-nuts
See https://go.dev/ref/mod#environment-variables GOPROXY=file://$(go env GOMODCACHE)/cache/download - sean On Mon, Apr 25, 2022 at 10:08 PM David Arsenault wrote: > Hello. I was hoping to get some smart advice on a problem using go on a > closed network. > > Summary: > - closed network, no ou

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

2022-04-25 Thread &#x27;Sean Liao&#x27; via golang-nuts
Back in 2016 the decision was "working as intended", ref: https://github.com/golang/go/issues/16622#issuecomment-255391314 - sean On Mon, Apr 25, 2022 at 5:58 PM 'Tim Hockin' via golang-nuts < golang-nuts@googlegroups.com> wrote: > We have some packages we would like to break out into their own

Re: [go-nuts] Tool to check binaries for vulnerabilities

2022-04-15 Thread &#x27;Sean Liao&#x27; via golang-nuts
If you only need to target 1.18+, you can use `debug/buildinfo.ReadFile` which doesn't require shelling out to go On Fri, Apr 15, 2022 at 7:03 AM Zhaoxun Yan wrote: > That sounds great! Thanks. > > 在2022年4月15日星期五 UTC+8 05:55:27 写道: > >> On Thu, 2022-04-14 at 03:05 -0700, Michel Casabianca wrote

Re: [go-nuts] io.WriteString to a file panics

2022-04-12 Thread &#x27;Sean Liao&#x27; via golang-nuts
> output, err := os.Create(o) The short variable declaration you used to create `err` also shadows `output`. var err error output, err = os.Create(o) On Tue, Apr 12, 2022 at 8:53 AM Rory Campbell-Lange wrote: > I have a command line programme that can output to either stdout or a > named file.

Re: [go-nuts] Allow a TCP connection, but not a TLS connection based on an ACL

2022-03-28 Thread &#x27;Sean Liao&#x27; via golang-nuts
if max := 1 * time.Second; tempDelay > max { > tempDelay = max > } > srv.logf("http: Accept error: %v; retrying in %v", err, tempDelay) > time.Sleep(tempDelay) > continue > } > return err >} > > &g

Re: [go-nuts] Allow a TCP connection, but not a TLS connection based on an ACL

2022-03-28 Thread &#x27;Sean Liao&#x27; via golang-nuts
I would just add a for loop around your code and only return when you have a connection you want to allow, otherwise just log / pass the error elsewhere. On Mon, Mar 28, 2022 at 11:26 PM John wrote: > I'm looking to satisfy this: > >- If you are in an ACL, you can make a TLS connection >

Re: [go-nuts] GO routine never exits based on stop condition - unable to find the reason

2022-03-28 Thread &#x27;Sean Liao&#x27; via golang-nuts
1. your generator never finished 2. your work channel still has things in it, there's no guarantee select will choose done first 3. reading from a closed channel will give you a zero value On Mon, Mar 28, 2022, 16:53 Gowtham Raj wrote: > In this example, we have a *worker*. The idea here is sim

Re: [go-nuts] Golang Packages

2022-03-16 Thread &#x27;Sean Liao&#x27; via golang-nuts
It's available if you use the generated pseudoversion as the version in the pkgsite url . you can get it via a call to go get (which is necessary to populate the proxy for pkgsite). A bit difficult to demonstrate on your module as testbranch right now points to v0.0.1 which takes precedence. On We

Re: [go-nuts] debug.ReadBuildInfo is info.Main.Version always "(devel)"

2022-03-16 Thread &#x27;Sean Liao&#x27; via golang-nuts
not yet https://github.com/golang/go/issues/50603 -- 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+unsubscr...@googlegroups.com. To view this discussio

Re: [go-nuts] go run strips symbols

2022-03-14 Thread &#x27;Sean Liao&#x27; via golang-nuts
go run -ldflags="-s=false" . -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit h