On Thu Apr 1, 2021 at 4:45 PM -03, Sharan Guhan wrote:
> r := regexp.MustCompile(`Core Count: [0-9]+`)
> match := r.FindAllStringSubmatch(cmd_output, -1)
As of the "efficiently" part, you should compile the regexp once
instead of each call to ParseFillCpuInfo, a common practice is to use
a package
On Tue, 6 Apr 2021 19:39:00 -0400
rob wrote:
> > This example is on Win10 using go 1.16.3
>
> Now I've created a directory tree outside of ~/go/src. I'm using ~
> to mean %userprofile%, as this is win10
>
> ~/gcode/rpng/rpng.go
>
> ~/gcode/tokenize/tokenize.go
>
> ~/gcode/hpcalc2/hpcalc2.go
On Wed, 7 Apr 2021 20:11:22 -0400
rob wrote:
> Would it be a bad idea to use my ~go/src as a module?
>
I don't think so, I do have one global module like this for my own toys
and throwaways programs. Yes, it would need to adjust your import paths
according to the module, when I migrated to modu
On Mon Apr 12, 2021 at 5:04 AM -03, Henry wrote:
> The example you gave is actually a map[rune]bool in Go, and not an
> array. I
It's a Go array in form of a composite literal, see
https://golang.org/ref/spec#Composite_literals
--
You received this message because you are subscribed to the Googl
On Mon Apr 12, 2021 at 10:23 AM -03, Xiangdong Ji wrote:
> Hi,
>
> I'm trying to run "go vet -vettool=$(which fieldalignment) ./..." for a
> large project, and wish to turn its '-fix' option on, wondering how to
> pass
> that option?
Hi Xiangdong, I found that surprising that even docs didn't ment
On Tue Apr 13, 2021 at 2:14 PM -03, Orson Cart wrote:
> Can anyone explain the reasoning behind this? It rather interferes with
> debugging traffic using a local proxy like Fiddler.
>
My guess here it's for preventing the remote from tricking the proxy to
make request to internal services that cou
On Tue Apr 13, 2021 at 7:07 PM UTC, Orson Cart wrote:
> I'm perplexed :(
>
Did you tried the /etc/hosts? I think that would do it, if not,
something like this may do the trick:
if debug {
t := http.DefaultTransport.(*http.Transport)
t.Proxy = func(r *http.Request) (*url.URL, error
On Wed Apr 14, 2021 at 12:25 AM -03, Xiangdong Ji wrote:
> I tried to modify fieldalignment to turn its '-fix' option on by
> default, change worked as expected if running fieldalignment as a
> standalone utility, but no rewriting is applied when running it as a
> tool of 'go vet', could any expert
On Sat May 1, 2021 at 11:12 AM -03, Kamil Ziemian wrote:
> Can you guide me to some materials about const in Go? Or maybe I should
> finally read Go spec, which I avoid for a long time?
>
You shouldn't avoid to read the spec, it's not as complicated as others
languages, and it's a great source of
On Fri May 7, 2021 at 11:10 AM -03, Eric Garcia wrote:
> Was trying to install all the tools, and hit the following errors.
>
> go version 1.16.3
>
> ```
> go get -u golang.org/x/tools/...
>
I think with go1.16 and later the correct way of installing programs
is with go install, it builds clean fo
On Tue Nov 30, 2021 at 11:20 PM CET, LastName Almaember wrote:
> It's meant to first read a nine-byte header (8 bits of a type field
> followed by a 64 bit length). In theory, it should work fine, but it
> always immediately returns InputTooShort (right at the first check).
io.Readers returns up t
On Thu Mar 10, 2022 at 12:41 PM CET, Manlio Perillo wrote:
> Interesting example, thanks.
>
> But how does `type self *self` works? If I remember correctly, it is not
> discussed in the Language Specification and in The Go Programming Language
> book.
>
I don't think it's mentioned in the specifi
On Sat Apr 9, 2022 at 3:56 PM CEST, 'Jack Li' via golang-nuts wrote:
> Why literal operation is exact, variable is not?
>
> fmt.Println(0.1 + 0.2) // 0.3 exactly
> fmt.Println(x + y) // 0.30004
>
Both aren't exact because floats can't represent 0.3 exactly, they
differ because literals
On Sun Apr 10, 2022 at 4:23 AM CEST, jlfo...@berkeley.edu wrote:
> Other than what's in the Go distribution, I haven't been able to find any
> packages for accessing .a archives. Is there anything else out there?
> Google wasn't helpful.
>
> Cordially,
> Jon Forrest
>
I found these using https://p
On Wed Apr 20, 2022 at 6:16 PM CEST, Dean Schulze wrote:
> I need to execute this tar command
>
> *tar xzf dir1/dir2/somefile.tgz --directory=dir1/dir2/*
>
Did you considered using the packages "archive/tar" and
"compress/gzip" to achive this?
> *argStr := "xzf dir1/dir2/somefile.tgz --directory=
Also, the Output method only returns what was wrote to stdout, tar
argument parsing errors are probably in stderr, using CombinedOutput()
has better effect to debug.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group a
On 08/10/2022 22:56, davy zhang wrote:
Original post on stackoverflow:
https://stackoverflow.com/questions/73985794/for-range-loop-variable-passing-by-reference-to-go-routine-causes-memory-leak
Code for reproducing the problem:
https://go.dev/play/p/7Xzx1Aauzhh
go version go1.19 darwin/amd64
On 10/9/22 11:09, Dmitry Belyaev wrote:
For a function like below I'd get only *example // doc comment*,
// doc comment
func example() {
// body comment < looking to extract this comment
}
but I am looking also to extract *// body comment*.
Please advise on how to extract function nam
On 1/10/23 11:42, Daniel Jankins wrote:
Hi,
Why can you update a value in a map struct?
Sort answer, because m["foo"] is not addressable, but you can have the
desired behavior using a temp variable:
func f() {
m := make(map[string]struct{ i int })
x := m["foo"]
x.i
On 1/13/23 07:20, Gorka Guardiola wrote:
According to the spec it seems like it is legal to shadow a type with a
variable, even a builtin type.
Is there any specific rationale for this? I guess that it makes scoping
checks easier and faster, but still.
I don't think there is any special rati
On Tue Oct 3, 2023 at 05:54 AM UTC, Kurtis Rader wrote:
> Thank you to Ian and TheDiveO. I don't understand why functions like
> gocv.io/x/gocv.NewWindow() have to run on the initial OS thread (at least
> on macOS).
It's common for C and C++ libraries to use TLS (thread local storage)
to attach d
a2800276 wrote:
> Just out of curiosity, does anyone have a good rationale as to why there
> are only unsigned conversions available `binary.ByteOrder`? It would seem
> that this functionality is there to avoid dumb careless errors doing byte
> order conversions, but this design forces me to ha
a2800276 wrote:
> I agree it has no technical merit. It can't do better, but it avoid having
> to think about the type mismatch. The functionality provided by ByteOrder
> is fairly simple to begin with, I assume its whole purpose is to reduce
> cognitive load/avoid dumb mistakes. My assumption
Jochen Voss wrote:
> Now I just want to run one of these sub-benchmarks. I tried -bench
> '^BenchmarkTextLayout/CFFSimple1$' but this runs two of the benchmarks:
>
> > go test -run=^$ -bench '^BenchmarkTextLayout/CFFSimple1$'
> goos: darwin
> goarch: arm64
> pkg: seehuhn.de/go/pdf/graphics
> Ben
24 matches
Mail list logo