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

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

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 'Sean Liao' 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

Re: [go-nuts] https client 403 error

2023-12-29 Thread 'Sean Liao' 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 := { TLSClientConfig: {InsecureSkipVerify: > true}, } > client := { Transport: tr, } > req, err :=

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

2023-10-23 Thread 'Sean Liao' 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,

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

2023-09-15 Thread 'Sean Liao' 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

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

2023-08-29 Thread 'Sean Liao' 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

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

2023-08-23 Thread 'Sean Liao' 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 'Sean Liao' 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

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

2023-08-18 Thread 'Sean Liao' 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 'Sean Liao' 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

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

2023-07-12 Thread 'Sean Liao' 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 'Sean Liao' 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 'Sean Liao' 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

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

2023-04-15 Thread 'Sean Liao' via golang-nuts
.go > package main > > import ( > "a_module_path" > "fmt" > ) > > func main() { > fmt.Println(a_module_path.Abs(-2)) > } > > I mean... i'm actually importing it without utill.. so the message kind of > confuse me. > > Thanks again. >

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

2023-04-15 Thread 'Sean Liao' 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

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

2023-03-30 Thread 'Sean Liao' 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: > >

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

2023-03-25 Thread 'Sean Liao' 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 >

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

2023-03-10 Thread 'Sean Liao' 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

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

2023-03-10 Thread 'Sean Liao' 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

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

2023-03-01 Thread 'Sean Liao' 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 'Sean Liao' 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.

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

2023-01-20 Thread 'Sean Liao' via golang-nuts
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, > > GOPAT

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

2023-01-20 Thread 'Sean Liao' 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

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

2022-12-19 Thread 'Sean Liao' 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

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

2022-12-19 Thread 'Sean Liao' 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

Re: [go-nuts] Refresher tutorial

2022-12-10 Thread 'Sean Liao' 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

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

2022-12-03 Thread 'Sean Liao' 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

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

2022-12-03 Thread 'Sean Liao' 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 >

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

2022-12-02 Thread 'Sean Liao' 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

Re: [go-nuts] Fetch pseudo-versions

2022-12-02 Thread 'Sean Liao' 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

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

2022-11-23 Thread 'Sean Liao' 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

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

2022-11-11 Thread 'Sean Liao' 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

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

2022-11-10 Thread 'Sean Liao' 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

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

2022-10-10 Thread 'Sean Liao' 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

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

2022-10-10 Thread 'Sean Liao' 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 'Sean Liao' 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 'Sean Liao' 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 'Sean Liao' 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

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

2022-08-27 Thread 'Sean Liao' 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

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

2022-08-27 Thread 'Sean Liao' 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.

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

2022-08-26 Thread 'Sean Liao' via golang-nuts
ess secure, at least according to > several other reputable security resources. Who's correct here? > > On Thursday, August 25, 2022 at 1:30:11 PM UTC-7 Diana Tuck wrote: > >> Yes, I'm aware it's intentional, but it causes a lower security grade on >> SSLLabs <https://ssllab

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

2022-08-25 Thread 'Sean Liao' 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

Re: [go-nuts] Go multiplexers

2022-08-20 Thread 'Sean Liao' 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 'Sean Liao' 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

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

2022-06-30 Thread 'Sean Liao' 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

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

2022-06-29 Thread 'Sean Liao' 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

Re: [go-nuts] defer func running timing

2022-06-25 Thread 'Sean Liao' 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

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

2022-06-25 Thread 'Sean Liao' 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 >

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

2022-06-20 Thread 'Sean Liao' 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

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

2022-06-11 Thread 'Sean Liao' 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

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

2022-06-10 Thread 'Sean Liao' 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

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

2022-06-02 Thread 'Sean Liao' 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() // equivalent to above If everything was a pure function, it'd look much like the

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

2022-05-28 Thread 'Sean Liao' 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

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

2022-05-25 Thread 'Sean Liao' 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 'Sean Liao' 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

Re: [go-nuts] OAuth2 HttpClient customizable header

2022-05-18 Thread 'Sean Liao' 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

Re: [go-nuts] OAuth2 HttpClient customizable header

2022-05-18 Thread 'Sean Liao' 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]( >

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

2022-05-09 Thread 'Sean Liao' 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 'Sean Liao' 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

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

2022-05-02 Thread 'Sean Liao' 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

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

2022-04-27 Thread 'Sean Liao' 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

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

2022-04-25 Thread 'Sean Liao' 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

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

2022-04-25 Thread 'Sean Liao' 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

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

2022-04-15 Thread 'Sean Liao' 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

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

2022-04-12 Thread 'Sean Liao' 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

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

2022-03-28 Thread 'Sean Liao' 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 'Sean Liao' 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 'Sean Liao' 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

Re: [go-nuts] Golang Packages

2022-03-16 Thread 'Sean Liao' 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

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

2022-03-16 Thread 'Sean Liao' 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

Re: [go-nuts] go run strips symbols

2022-03-14 Thread 'Sean Liao' 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

[go-nuts] Re: workspaces tutorial query

2022-03-12 Thread Sean Liao
Fixed on tip ref: https://go.dev/issue/51449 On Saturday, March 12, 2022 at 9:40:04 AM UTC kortschak wrote: > I was just taking a look at the workspaces tutorial and saw that while > the doc says that adding the local example module will result in > > go 1.18 > > use ( > ./hello > ./example > )

[go-nuts] Re: Possible float64 precision problem

2022-03-09 Thread Sean Liao
It would help if your could show the actual code for both C and Go, as well as the input On Wednesday, March 9, 2022 at 11:37:10 AM UTC christoph...@gmail.com wrote: > I'm translating a scientific C program into Go that is doing some 64bit > floating point operations. > > In this process I

[go-nuts] Re: how to solve the go.mod conflict when 2 sub-modules point to break version of a common module

2022-03-07 Thread Sean Liao
Splitting the uses of a/b into their own modules/repo won't work if you ultimately import them into a single module. It would be the same problem, just further down the dependency tree. On Monday, March 7, 2022 at 7:14:17 PM UTC ian.zh...@gmail.com wrote: > > Thanks for your reply. > > It's sad

[go-nuts] Re: how to solve the go.mod conflict when 2 sub-modules point to break version of a common module

2022-03-07 Thread Sean Liao
As a v0.x.y module, it's explicitly signaling that it may introduce incompatible changes between minor versions, as has happened here. unfortunately for you, a module can only exist at a single version within a build, so you'll have to modify your dependencies. Some time ago, OpenTelemetry

[go-nuts] Re: is url->String->Parse != url a bug?

2022-03-04 Thread Sean Liao
Expected, the percent encoded version produced by String() is semantically equivalent and safer than the raw space version, and also doesn't require storing the raw version. On Friday, March 4, 2022 at 1:10:22 PM UTC joche...@gmail.com wrote: > Hello, > > If I convert an url.URL to a string

[go-nuts] Re: Migrating to go modules with package name different from VCS

2022-02-23 Thread Sean Liao
See https://pkg.go.dev/cmd/go#hdr-Remote_import_paths specifically: > The meta tag has the form: > If you serve the meta tags over HTTPS on the package path, you can point it to the appropriate git repo On Wednesday, February 23, 2022 at 2:54:25 PM UTC+1 luxif...@gmail.com wrote: > Hello, >

[go-nuts] Re: go log.Println(http.ListenAndServe(...)) blocks

2022-02-18 Thread Sean Liao
https://go.dev/ref/spec#Go_statements : > The function value and parameters are evaluated as usual in the calling goroutine, but unlike with a regular call, program execution does not wait for the invoked function to complete. http.ListenAndServe is being

[go-nuts] Re: Getting "$GOPATH/go.mod exists but should not" when running build in a Docker image

2022-02-11 Thread Sean Liao
The `golang` container image sets the GOPATH directory to /go and the working directory to /go too. Following GOPATH layout, source code is expected to be in directories under /go/src. `/go/bin` is where binaries are installed by default, and `/go/pkg` include things like the module cache. With

Re: [go-nuts] Why Go allow function with unused arguments?

2022-01-30 Thread Sean Liao
By enforcing blanks, you'd lose the chance to name them something useful to tell the reader why they're ignored. eg: // why are the last 2 args ignored?? handleX = func(foo, bar, _, _ string) string { return foo + bar } On Sunday, January 30, 2022 at 10:21:11 PM UTC+1

Re: [go-nuts] Re: Should dev tools be tracked by go.mod?

2022-01-25 Thread Sean Liao
a problem if your tools introduce a version higher than what your consumer would otherwise have selected. On Monday, January 24, 2022 at 10:45:29 PM UTC+1 sv...@redhat.com wrote: > Hi Sean, > > Thanks a lot for your answer! > > On Mon, Jan 24, 2022 at 9:01 PM Sean Liao wrote: > >

[go-nuts] Re: Should dev tools be tracked by go.mod?

2022-01-24 Thread Sean Liao
As a (hypothetical) consumer of your library, I would definitely appreciate fewer dependencies, mostly to reduce the chance of (or difficulty of resolving) conflicts with any other dependencies I may have (especially painful when incompatible v0.X.Y transitive dependencies are used). It

[go-nuts] Re: Go doc examples from the command line?

2022-01-21 Thread Sean Liao
nope https://github.com/golang/go/issues/26715 On Friday, January 21, 2022 at 11:38:19 AM UTC+1 steve@gmail.com wrote: > I've been using, for example. "go doc -all encoding/csv" to display > docs from the command line. > > Is there any of displaying the code examples visible from the go.dev

[go-nuts] Re: pkg.go.dev is showing module, but not its package documentation

2022-01-13 Thread Sean Liao
Nope, pkg.go.dev doesn't support type parameters yet https://github.com/golang/go/issues/48264 On Thursday, January 13, 2022 at 10:50:18 AM UTC+1 po...@debevv.com wrote: > Hi, I'm having a weird problem with pkg.dev.go. Recently I published a > module on github

[go-nuts] Re: Gradual change of package path

2021-12-20 Thread Sean Liao
You're right about the source of the error you're seeing (subfolder of root + independent module). If you just want to get rid of the error, update your versions of the 2 modules so they both have the same view of module boundaries. But you don't need 2 separate modules for this, and you

[go-nuts] Re: Does pkg.go.dev understand packages that use generics?

2021-12-18 Thread Sean Liao
not yet, see https://github.com/golang/go/issues/48264 On Saturday, December 18, 2021 at 4:23:30 PM UTC+1 kee...@gmail.com wrote: > I created github.com/keep94/consume2 which is a rewrite of > github.com/keep94/consume using Go generics. However, the new package is > not showing up in

[go-nuts] Re: generics: what can we do with an any type?

2021-12-15 Thread Sean Liao
when writing type parameterized code, it has to work with anything that could be passed to it. but once instantiated, the type is known and it can be used with its concrete type like `map` can be thought of as declared to be `map[comparable]any` but when you use it, the type is always known,

Re: [go-nuts] Re: Flag fall through logic review

2021-11-16 Thread Sean Liao
I would go for something more like: https://play.golang.org/p/MyorlUwOL9s and not bother with the intermediate checks, just read directly and report any issues you encounter On Tuesday, November 16, 2021 at 3:49:54 PM UTC+1 leam...@gmail.com wrote: > Brian, thanks! Here's the playground link:

[go-nuts] Re: Trying to code an observer pattern or a publish/submit pattern for a cellular automaton

2021-11-14 Thread Sean Liao
that's exponential growth, every value results in 2 output values input "1" x1, get "2" x2, "3" x4, "4" x8, "5" x16, ... also your use of goroutines to send mean you'll still run out of memory at some point On Sunday, November 14, 2021 at 2:29:26 PM UTC Serge Hulne wrote: > Hi, > > I am trying

[go-nuts] Re: compile time error vs runtime crash for same array

2021-11-13 Thread Sean Liao
global variables are stored in there data section of the compiled binary, the linker imposes a 2GB size limit the array in main can be allocated at runtime, and given enough memory, it could succeed On Saturday, November 13, 2021 at 5:46:29 PM UTC arthurwil...@gmail.com wrote: > On a 64bit

[go-nuts] Re: Correct usage of Google Api Client

2021-11-08 Thread Sean Liao
svc, err := indexing.NewService() res, err := svc.UrlNotifications.Publish({ /* things in here */ }).Do() On Monday, November 8, 2021 at 6:59:31 PM UTC+1 ladonkin...@gmail.com wrote: > Hi, > > I'm new to Golang so sorry if the question seems stupid. > > I'm trying to inform google about a new

Re: [go-nuts] Various questions about posts from The Go Blog

2021-11-08 Thread Sean Liao
rst version of our Hello() >> function, it FAILS with the second. >> >> According to description quote.Hello() ( >> https://pkg.go.dev/rsc.io/quote#Hello), but from source code we know >> that in fact it returns a string returned by sampler.Hello(pre

Re: [go-nuts] Various questions about posts from The Go Blog

2021-10-30 Thread Sean Liao
Technically that behaviour is still available via GO111MODULE=auto. Go 1.16 changed the default from "auto" to "on". On Saturday, October 30, 2021 at 11:17:05 PM UTC+2 kziem...@gmail.com wrote: > Hello, > > I don't have energy today to read Go language spec or learning how UTF-8 > works, so I

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

2021-10-28 Thread Sean Liao
There isn't much to it, a "production_name" is just an identifier for the set of values defined on the other side of the =, some of which may also be identifiers that should be dereferenced/expanded If it helps, there's a wikipedia entry on it:

[go-nuts] Re: x/crypto/openpgp missing support for uncompressed data in compressed data packets

2021-10-17 Thread Sean Liao
Note as of https://github.com/golang/go/issues/44226 x/crypto/openpgp is frozen and deprecated On Saturday, October 16, 2021 at 9:01:42 PM UTC+2 arud...@stripe.com wrote: > Hello, > > I think I may have found a bug in the x/crypto/openpgp implementation. > However, I wanted to ask here to make

[go-nuts] Re: Problem using embed in Go 1.16

2021-10-10 Thread Sean Liao
import _ "embed" It means to import it for side effects only On Sunday, October 10, 2021 at 6:12:07 PM UTC+2 sunto...@gmail.com wrote: > Hi, > > I'm having problem using embed with Go 1.16. I'm getting ether > > - //go:embed only allowed in Go files that import "embed" > - or imported and not

  1   2   >