[go-nuts] Re: Failing unit test in Windows (TestLookupLocalPTR)

2025-02-22 Thread Mark Geisert
. HTH, ..mark On Saturday, February 22, 2025 at 4:53:01 PM UTC-8 Albert S wrote: > Hello Gophers, > > I'm running unit test in my local windows machine (Windows 11 Pro) and I > get a test failure for TestLookupLocalPtr using my locally compiled Go 1.25 > > here is the test comm

[go-nuts] Compile-time control flow with type inference

2024-11-04 Thread Mark Mavzon
Tried writing a poor man's union (sum) "type" using generic functions and recursion but found an issue. Here's the code: type nothing any type Or[V, R any] struct { value any rest any } func NewOr[V any]() Or[V, nothing] { return Or[V, nothing]{nil, nil} } func TypeOr[V, W, R any](or Or[W, R]) Or[

Re: [go-nuts] The usage of method call syntax for regular functions as a way to have "generic methods"

2024-11-02 Thread Mark Mavzon
*Axel Wagner*, I've "read" the thread you linked (read some posts and skimmed through others) and also read the following article (which I should've read sooner): https://research.swtch.com/interfaces and now I understand the issue a little bit better (hopefully). As a result I have the only su

[go-nuts] The usage of method call syntax for regular functions as a way to have "generic methods"

2024-10-28 Thread Mark Mavzon
As we all know Go doesn't have generic methods. The FAQ states: * "We do not anticipate that Go will ever add generic methods".* Also the FAQ lists 4 options out of which the last one seems reasonable: * Define that generic methods cannot be used to satisfy

Re: [go-nuts] Question about adding new feature to go (FreeBSD/netlink) and compliation

2024-09-04 Thread Mark Geisert
Maybe a red herring, but you do have GOROOT='/usr/local/go122' in the output of go env in your original post. ..mark On Tuesday, September 3, 2024 at 10:40:58 AM UTC-7 Martin Stiemerling wrote: > > > > Am 03.09.2024 um 19:27 schrieb Ian Lance Taylor : > > > &g

Re: [go-nuts] Can't figure out how to create an All() iter.Seq[T] method

2024-03-13 Thread 'Mark' via golang-nuts
Thank you, that solved the problem. On Wednesday, March 13, 2024 at 1:22:06 PM UTC Sebastien Binet wrote: > hi Mark, > > On Wed Mar 13, 2024 at 13:32 CET, 'Mark' via golang-nuts wrote: > > I've been trying to learn how to create an `All() iter.Seq[T]` method > &

[go-nuts] Can't figure out how to create an All() iter.Seq[T] method

2024-03-13 Thread 'Mark' via golang-nuts
I've been trying to learn how to create an `All() iter.Seq[T]` method for a simple set type (a map wrapper): playground It won't work in the playground of course, but when I do: `GOEXPERIMENT=rangefunc go run .` using Go 1.22 I get this error: ``` cann

[go-nuts] range func experiment typo?

2024-01-19 Thread 'Mark' via golang-nuts
In the RangefuncExperiment doc it says: for k, v := range g { ... } // g has type Seq[K,V], k and v have types K and V but shouldn't this be: for k, v := range g { ... } // g has type Seq2[K,V], k and v have types K and V Anyway, it looks interesting

Re: [go-nuts] a simple linux audio player pkg?

2023-11-23 Thread 'Mark' via golang-nuts
Endian, f); err != nil { panic(err) } } return buf.Bytes() } On Thursday, November 23, 2023 at 10:03:24 AM UTC Mark wrote: > I've now tried using those libraries, but there seems to be an > incompatibility []float32 vs []byte. > Here's the error: > > ./play.go:24:29: c

Re: [go-nuts] a simple linux audio player pkg?

2023-11-23 Thread 'Mark' via golang-nuts
e used github.com/jfreymuth/oggvorbis to read the ogg file (and > convert to PCM) and github.com/ebitengine/oto/v3 to play the PCM. > I don't know of a full ogg player in Go > > > On Wed, Nov 22, 2023 at 2:02 PM 'Mark' via golang-nuts < > golan...@googlegroups.com&

Re: [go-nuts] a simple linux audio player pkg?

2023-11-23 Thread &#x27;Mark' via golang-nuts
nd > convert to PCM) and github.com/ebitengine/oto/v3 to play the PCM. > I don't know of a full ogg player in Go > > > On Wed, Nov 22, 2023 at 2:02 PM 'Mark' via golang-nuts < > golan...@googlegroups.com> wrote: > >> Is there a simple vorbis/oga aud

[go-nuts] a simple linux audio player pkg?

2023-11-22 Thread &#x27;Mark' via golang-nuts
Is there a simple vorbis/oga audio player package for Go that works on Linux. The only API I need is something like this: player.SetFilename(string) error // string is say tune.ogg; stops playing previous if any player.Play(float32) error // plays current filename from given second e.g. 0.0 for

[go-nuts] Re: Is there a Go equivalent to Python's ctypes library?

2023-11-21 Thread &#x27;Mark' via golang-nuts
Tamás Gulácsi wrote: > Which is what? > Please share with the golang-nuts list if you've found a solution! > > Mark a következőt írta (2023. november 21., kedd, 11:54:11 UTC+1): > >> Thank you, that looks just like what I want. >> >> On Tuesday, November 21, 2023 at

[go-nuts] Re: Is there a Go equivalent to Python's ctypes library?

2023-11-21 Thread &#x27;Mark' via golang-nuts
Thank you, that looks just like what I want. On Tuesday, November 21, 2023 at 10:21:14 AM UTC Mark wrote: > I would like to be able to access a dynamic C library (and ideally C++), > i.e., `.so` or `.dll` _without_ using cgo, i.e., without needing a compiler > on the target platform.

[go-nuts] Is there a Go equivalent to Python's ctypes library?

2023-11-21 Thread &#x27;Mark' via golang-nuts
I would like to be able to access a dynamic C library (and ideally C++), i.e., `.so` or `.dll` _without_ using cgo, i.e., without needing a compiler on the target platform. Python provides a `ctypes` module with this facility. Is there an equivalent for Go? -- You received this message because

Re: [go-nuts] bufio.Scanner - possible bug or doc err?

2023-10-14 Thread &#x27;Mark' via golang-nuts
Yes, that's a much better solution. On Friday, October 13, 2023 at 8:40:45 PM UTC+1 Ian Lance Taylor wrote: > On Thu, Oct 12, 2023 at 11:42 PM 'Mark' via golang-nuts > wrote: > > > > Yes, I can see now. > > > > Perhaps consider changing: >

Re: [go-nuts] bufio.Scanner - possible bug or doc err?

2023-10-12 Thread &#x27;Mark' via golang-nuts
MaxScanTokenSize), or must run sequential scans on a reader, should use bufio.Reader instead. Just a thought. Thanks. On Thursday, October 12, 2023 at 8:56:05 PM UTC+1 Ian Lance Taylor wrote: > On Thu, Oct 12, 2023 at 10:21 AM 'Mark' via golang-nuts > wrote: > > > >

Re: [go-nuts] bufio.Scanner - possible bug or doc err?

2023-10-12 Thread &#x27;Mark' via golang-nuts
nd it worked fine, so I > suspect it's a bug in your code. But if not, please provide a complete > working executable example, with data, to help identify the problem. > > -rob > > > On Thu, Oct 12, 2023 at 7:39 PM 'Mark' via golang-nuts < > golan...@googleg

[go-nuts] bufio.Scanner - possible bug or doc err?

2023-10-12 Thread &#x27;Mark' via golang-nuts
I'm reading Debian *Package files, some of which are over 1M lines long. I used bufio.Scanner and found that it won't read past 1M lines (I'm using Go 1.21.1 linux/amd64). Is this a limitation of bufio.Scanner? If so then it ought to be in the docs. Or is it a bug? Or maybe I made a mistake (alth

[go-nuts] How to constrain an integral type's values

2023-09-08 Thread &#x27;Mark' via golang-nuts
I often create small multi-value flag types, e.g. ```go type mode uint8 const ( argMode mode = iota baseMode cmdMode ) ``` The problem is that if I write, say, `m := baseMode`, although `m` has the correct type (`mode`), there is no way to constrain its values to the consts I've declared. In th

[go-nuts] Re: How to convert an svg to a png (or gif) image?

2023-08-04 Thread &#x27;Mark' via golang-nuts
Thanks! On Friday, August 4, 2023 at 8:46:18 AM UTC+1 Tamás Gulácsi wrote: > https://pkg.go.dev/github.com/goki/gi/svg > > Mark a következőt írta (2023. augusztus 3., csütörtök, 13:18:48 UTC+2): > >> I know this has been asked before, just wondered if there were any &g

[go-nuts] How to convert an svg to a png (or gif) image?

2023-08-03 Thread &#x27;Mark' via golang-nuts
I know this has been asked before, just wondered if there were any pure-Go solutions? -- 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...@goo

[go-nuts] Re: Error handling

2023-07-30 Thread &#x27;Mark' via golang-nuts
Given that this proposal is to reduce boilerplate, and assuming the semantic issues could be solved, it seems to me that the 'return' is redundant (i.e., could be implicit) and that 'orelse' could be done with the existing 'else' keyword, i.e., ``` result, err := someCall() else rest, err ``` A

[go-nuts] Re: Can a struct be made comparable?

2023-07-14 Thread &#x27;Mark' via golang-nuts
I finally worked out how to make my go-diff pkg <https://pkg.go.dev/github.com/mark-summerfield/go-diff> (v1.1.0) able to diff sequences of structs based on a key function. On Friday, July 14, 2023 at 12:27:46 PM UTC+1 Mark wrote: > Hi Brian, > Ah, thank you, that helped a lot. &

[go-nuts] Re: Can a struct be made comparable?

2023-07-14 Thread &#x27;Mark' via golang-nuts
t is a > slice, then Atoi(change.Path[0]) is the index into the slice. > > On Friday, 14 July 2023 at 10:47:47 UTC+1 Mark wrote: > >> Hi Brian, >> Your code certainly identifies the different items. >> However, that's not a diff tool in the sense I mean. >> Uni

[go-nuts] Re: Can a struct be made comparable?

2023-07-14 Thread &#x27;Mark' via golang-nuts
ice x into slice y. There are quite a few go diff tools that will do this, including my own <https://pkg.go.dev/github.com/mark-summerfield/go-diff> based on Python's difflib sequence matcher. What I want to do is find one that does this for slices of structs where only one struct fi

[go-nuts] Re: Can a struct be made comparable?

2023-07-14 Thread &#x27;Mark' via golang-nuts
41 AM UTC+1 Mark wrote: > What I really want to do is to be able to diff slices of structs on the > basis of one single field. > For example, given: > ``` > type Item struct { > I int > S string > } > ``` > and given `a` and `b` are both of type`[]Item`, I want t

[go-nuts] Re: Can a struct be made comparable?

2023-07-14 Thread &#x27;Mark' via golang-nuts
go.dev/slices#CompactFunc >> https://pkg.go.dev/slices#EqualFunc >> >> For the case of "ordered" rather than "comparable", have a look at >> slices.BinarySearchFunc and related functions. >> >> On Thursday, 13 July 2023 at 09:29:38 UTC+1 Ma

[go-nuts] Can a struct be made comparable?

2023-07-13 Thread &#x27;Mark' via golang-nuts
I have a package which has a function `Do[T comparable](a, b []T) Result`. I have a struct: ```go type N struct { x int y int t string } ``` Is it possible to make `N` comparable; in particular by a field of my choice, e.g., `t`? Or will I have to make, say, `DoFunc(a, b []N, eq func(i, j N

[go-nuts] Doc suggestion (& one const suggestion)

2023-05-02 Thread &#x27;Mark' via golang-nuts
In the docs file modes are often shown in octal, e.g., `0600`. Doc suggestion: update octal to use the modern unambiguous format, e.g., `0o600`. Const suggestion: add at least one const to `os`, e.g., ```go const ModeUserRW = 0o600 // plus any one or two others that are really common? ``` If th

Re: [go-nuts] Which tool provide's the Go playground's import handling...

2023-01-06 Thread &#x27;Mark' via golang-nuts
Thanks, that's just what I needed :-) On Friday, January 6, 2023 at 8:21:02 AM UTC kortschak wrote: > On Fri, 2023-01-06 at 00:13 -0800, 'Mark' via golang-nuts wrote: > > If I visit the Go playground and change the body of `main()` to, say, > > `fmt.Println("he

[go-nuts] Which tool provide's the Go playground's import handling...

2023-01-06 Thread &#x27;Mark' via golang-nuts
If I visit the Go playground and change the body of `main()` to, say, `fmt.Println("hello", math.Abs(-5))` and then click Run, the `import "fmt"` line is _automatically_ corrected to be `import (\n\t"fmt"\n\t"math"\n)`. I'd like to be able to use this functionality so tha

Re: [go-nuts] How to fix an awful marshal reflection hack

2022-12-01 Thread &#x27;Mark' via golang-nuts
ormal processing. So the complete -- and working -- code is in the repo and go test works. But replacing the call to hack() with kind = field.Type().Elem().Kind() breaks the tests. On Thursday, December 1, 2022 at 1:09:50 PM UTC Marvin Renich wrote: > * 'Mark' via golang-nuts [22120

Re: [go-nuts] How to fix an awful marshal reflection hack

2022-12-01 Thread &#x27;Mark' via golang-nuts
I tried that and it works in the playground, and I added more types and it still works in the playground <https://go.dev/play/p/Yxzj4tAAGhM>. But in my program it still doesn't work:-( The actual code is here tdb-go <https://github.com/mark-summerfield/tdb-go> in the file mar

Re: [go-nuts] How to fix an awful marshal reflection hack

2022-12-01 Thread &#x27;Mark' via golang-nuts
I tried without the print statements too.) And, of course the tests fail. So I'm _still_ using the awful hack! On Wednesday, November 30, 2022 at 5:30:24 PM UTC bse...@computer.org wrote: > On Wed, Nov 30, 2022 at 10:17 AM 'Mark' via golang-nuts < > golan...@googlegroups.com

Re: [go-nuts] How to fix an awful marshal reflection hack

2022-11-30 Thread &#x27;Mark' via golang-nuts
Yes, I'd already tried that (that's what I started with) and unfortunately it doesn't work. On Wednesday, November 30, 2022 at 3:37:47 PM UTC bse...@computer.org wrote: > On Wed, Nov 30, 2022 at 5:29 AM 'Mark' via golang-nuts < > golan...@googlegroups.com&g

[go-nuts] How to fix an awful marshal reflection hack

2022-11-30 Thread &#x27;Mark' via golang-nuts
I have this code which works but has a horrible hack: ... nullable := false kind := field.Kind() // field's type is reflect.Value if kind == reflect.Ptr { // FIXME How can I improve upon this truly awful hack? switch field.Type().String() { case "*int", "*int8", "*uint8", "*int16", "*ui

[go-nuts] Re: How to read struct field names from an empty slice of structs

2022-11-21 Thread &#x27;Mark' via golang-nuts
After struggling, I finally solved it; playground <https://go.dev/play/p/w0OSFCX10Rx> On Monday, November 21, 2022 at 10:55:06 AM UTC Mark wrote: > I have a two level general-purpose data structure: a struct containing one > or more slices of structs. > I want to be able to us

[go-nuts] How to read struct field names from an empty slice of structs

2022-11-21 Thread &#x27;Mark' via golang-nuts
I have a two level general-purpose data structure: a struct containing one or more slices of structs. I want to be able to use reflection to populate this, but as a first step I want to extract the "table names" (i.e., the names of the fields of the outer struct), and the "field names" (the nam

Re: [go-nuts] Is it possible to switch on type T in a generic function?

2022-11-09 Thread &#x27;Mark' via golang-nuts
v/strings#Builder for > building a string > > On Tuesday, 8 November 2022 at 13:09:51 UTC Mark wrote: > >> Thanks for your help and very interesting ideas. In the end I used this: >> >> type Set[T comparable] map[T]struct{} >> >> func New[T comparable](ele

Re: [go-nuts] Is it possible to switch on type T in a generic function?

2022-11-08 Thread &#x27;Mark' via golang-nuts
o this: https://go.dev/play/p/oKTGSm_o22a > > To answer the specific question you asked, there is an issue that tracks > the ability to do a switch directly on a type parameter: > https://github.com/golang/go/issues/45380 > > But you can also work around the lack of that feature b

Re: [go-nuts] Is it possible to switch on type T in a generic function?

2022-11-08 Thread &#x27;Mark' via golang-nuts
t.Strings(elements) / s := "{" sep := "" for _, element := range elements { s += fmt.Sprintf("%s%s", sep, element) sep = " " } return s + "}" } On Tuesday, November 8, 2022 at 9:19:48 AM UTC Jan M

[go-nuts] Is it possible to switch on type T in a generic function?

2022-11-08 Thread &#x27;Mark' via golang-nuts
odule I've created: https://github.com/mark-summerfield/gset In the String() method I want to return a string with the elements sorted (for human readability and for testing convenience); but at the moment I can only do this by converting all elements to strings and sorting them which isn&

Re: [go-nuts] How do I set a pkg's version?

2022-11-02 Thread &#x27;Mark' via golang-nuts
Oh, except that debug.BuildInfo (unsurprisingly) is only available in debug not release builds. So I guess the answer is that there isn't any nice way to do it. On Wednesday, November 2, 2022 at 8:31:29 AM UTC Mark wrote: > I hadn't realised about debug.BuildInfo - thanks! &

[go-nuts] Trying to create a test app for a library package

2022-11-02 Thread &#x27;Mark' via golang-nuts
I have this layout: ``` mylib/ mylib/go.mod # module github.com/me/mylib mylib/mylib.go mylib/mylib_test.go ``` All this works fine, with both .go files being in the same pkg: mylib. However, there are some tests that I can't really do using the test module because they write to stdout. So I want

Re: [go-nuts] How do I set a pkg's version?

2022-11-02 Thread &#x27;Mark' via golang-nuts
like --version print the json. >> >> Note that this is about the version of some binary - not the version of a >> package. However, you could embed go.mod. But there may be better ways. >> >> Hope this helps. >> >> 'Mark' via golang-nut

[go-nuts] How do I set a pkg's version?

2022-11-01 Thread &#x27;Mark' via golang-nuts
I am creating a pkg. It has a `go.mod` file: ``` module github.com/.../mypkg go 1.19 ``` And code files with functions in .go files all in the mypkg pkg. How do I specify which version the mypkg pkg is? I know about using `$ git tag vX.Y.Z` and `$ git push origin vX.Y.Z`, but is there any way I

Re: [go-nuts] Go build speed dependent on time after source modification

2021-11-05 Thread Mark Fletcher
ng on 1.17.2 takes ~14 seconds. On tip, it takes ~5 seconds. Mark -- 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...@googlegr

Re: [go-nuts] Go build speed dependent on time after source modification

2021-11-04 Thread Mark Fletcher
d instead edit the file using vi, I get consistent 16 second compile times regardless of how long I wait. So, thanks for the suggestion. I still don't understand why my compile times are the same between the i9 and M1 Max, but I guess I need to do some more research. Thanks, Mark -- Y

[go-nuts] Go build speed dependent on time after source modification

2021-11-04 Thread Mark Fletcher
build does neither of these steps. Any thoughts/suggestions would be appreciated. Mark -- 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+

Re: [go-nuts] Why isn't go more popular?

2021-08-06 Thread Mark Sinoberg
can not agree more with u, go cool. 在2021年8月6日星期五 UTC+8 上午10:28:03 写道: > On Thu, Aug 5, 2021 at 7:20 PM Santi Ferra > wrote: > > > > When you see the ranking of the most liked programming languages, go is > near c++, a really "hated app". But since is efficient and produces really > clean code

[go-nuts] Re: Writing bitmap data to a canvas with WebAssembly

2020-07-24 Thread Mark Farnan
Little old, but this might also help. A while back I built a helper package to deal with these issues for canvas rendering from Go. https://github.com/markfarnan/go-canvas I'm currently working on it to add WebGL support & get it working in TinyGo (some issues still). Rega

[go-nuts] go.pkg.dev: blitznote.com/src/semver doesn't show up

2020-06-26 Thread Mark Kubacki
esults? Thanks, Mark -- 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] [generics] tiny typo in Map/Reduce/Filter examples

2020-06-17 Thread Mark
At the end of this section where it shows the outputs: ```go floats := slices.Map(s, func(i int) float64 { return float64(i) })// Now float2 is []float64{1.0, 2.0, 3.0}. ``` shouldn't that be: ```go floats := slices.Map(s, func(i int) float64 { return float64(i) })// Now floats is []float64{1.0,

[go-nuts] Re: Client certificate not sent to server

2020-05-19 Thread Mark Petrovic
I know this is an old thread, but I found it, so others might, too. I struggled with a similar problem of the Go HTTP client not sending client certs when challenged by the server. Yet, curl worked fine when given the same client certs, calling the same server endpoint. The cert chains I was

[go-nuts] SWIG-generated Go wrapper mishandling(?) pointers to pointers to structs

2020-04-17 Thread mark mellar
her than Book*, and then modifying the GetTitle function to receive a Book** instead of Book* things started working as expected. Any hints on how we might configure SWIG to generate a version of the code which works for us. without us having to hack what it generates? Thanks! Mark -

Re: [go-nuts] Cgo fixed length array woes

2020-01-29 Thread mark mellar
Thanks Ian! My C's a bit rusty, I'd expected I'd have to explicitly allocate some memory for rLimits, similar to askedHosts, turns out that isn't required after all and your suggestion of setting element by element is working like a charm! Thanks again, Mark On Tuesday,

Re: [go-nuts] JSON: Having trouble parsing map keys with dots like {"foo.bar":"baz"}

2020-01-29 Thread Mark Hansen
Ah, I see what's going on: Go is mapping the "qux" field to the Qux struct arg just because they're case-insensitively equal. Go's totally ignoring my invalid struct tag. D'oh, I was totally holding it wrong. Thanks everyone! :-) On Wed, 29 Jan 2020 at 08:12, Mar

Re: [go-nuts] JSON: Having trouble parsing map keys with dots like {"foo.bar":"baz"}

2020-01-28 Thread Mark Hansen
ng(t *testing.T) { > f := &Foo{} > d := json.NewDecoder(strings.NewReader(`{"baz.bar": "hello", "qux": > "hi"}`)) > err := d.Decode(f) > if err != nil { > t.Fatalf("json decoding failed: %v", err) > } > if f.Qux != &quo

[go-nuts] JSON: Having trouble parsing map keys with dots like {"foo.bar":"baz"}

2020-01-28 Thread mark
decoding failed: %v", err) } if f.Qux != "hi" { t.Fatalf("Expected f.Qux to be hi") } if f.BazBar != "hello" { t.Errorf("wanted: hello, got: %q", f.BazBar) } } And the Qux field passes fine, but the BazBar field is not set, so the test fails there: ---

[go-nuts] Cgo fixed length array woes

2020-01-28 Thread mark mellar
Hi Folks, I'm having some trouble instantiating a C struct from a 3rd party API. I'm not sure if this is more a C question or a Go question, details in the code below, any help would be much appreciated! M // This non-compiling example demonstrates an issue I'm having integrating a 3rd party

[go-nuts] InfluxData is hiring remote Go engineers

2019-09-26 Thread mark
InfluxData is the leading open source time series database, purpose built for monitoring metrics and events. We are expanding our talented engineering organization, and we are hiring for a lot of positions that primarily include programming in Go. I am personally one of Influx's first engineerin

[go-nuts] Tips for reproducing flaky Go tests

2019-08-15 Thread mark
I put together a blog post on reproducing flaky Go tests: https://www.influxdata.com/blog/reproducing-a-flaky-test-in-go/ This was the result of what I've learned spending many, many hours hunting down many unreliable tests. I hope these tips can help you out next time you have a test that fail

Re: [go-nuts] I know you cannot kill a goroutine, but ...

2019-08-10 Thread Mark Baldridge
I think I can handle the deadly embrace problem. The locks distribute into "slots" based upon inode%slotCount. Just information irrelevant to the observation. At the moment, I use RWMutex to protect each lock table slot since it was more like previous thoughts on this subject. However, I plan to co

Re: [go-nuts] Standard library ETag/Last-Modified conditional request logic and best practices?

2019-08-06 Thread mark . mcdx
Thanks Devon! So just to clarify our request flow is: Client > CDN > Go Reverse Proxy > Origin Our Go Reverse Proxy has historically been responsible for adding caching headers (e.g. Cache-Control and Surrogate-Control) when the origins have failed to do so (as a way to ensure things are cache

[go-nuts] Standard library ETag/Last-Modified conditional request logic and best practices?

2019-08-06 Thread mark . mcdx
the correct place to set it. 4. What constitutes a strong/weak validator (e.g. would a simple hash function generating a digest of the URL path + response body suffice)? Thanks for any help/insights/opinions y'all can share with me. Kind regards, Mark -- You received this message beca

[go-nuts] Reflection: How to retrieve index of map

2019-07-01 Thread Mark Bauermeister
I have the following code, where the TokenMap struct is actually part of another package. idMap is not exported and thus not accessible without reflection. Through reflection I can easily find the value of "int", which is "28". Now, I'd like to do the opposite though. I'd like to find "28"'s ind

[go-nuts] Re: [ANN] Gio: portable immediate mode GUI programs in Go for iOS/tvOS, Android, macOS, Linux, Windows

2019-06-14 Thread Mark Bauermeister
Any plans for a Vulkan back-end? -- 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 visi

[go-nuts] make an empty slice

2019-06-06 Thread Mark Bauermeister
You mean a slice that is not of type Exam? test []int Should work. Your slice does need to adhere to some type. -- 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

[go-nuts] Memory allocation question

2019-06-06 Thread Mark Bauermeister
Sorry in advance for the somewhat messy code, but this is something I've been trying to understand all day and can't quite come up with an explanation for. Basically, I wrote the below code to experiment with different data types and their impact on performance and memory efficiency. The code i

[go-nuts] Re: Write to bufio Scanner from outside os.Stdin

2019-05-29 Thread Mark Bauermeister
= "Test \n") and the reader should pick it up as if it was a manual input. Unfortunately, that doesn't quite seem to work yet. On Wednesday, 29 May 2019 19:26:58 UTC+2, Mark Bauermeister wrote: > > I'm in the process of writing a text adventure parser. > By

[go-nuts] Write to bufio Scanner from outside os.Stdin

2019-05-29 Thread Mark Bauermeister
I'm in the process of writing a text adventure parser. By default, the parser simply uses Stdin. i e for { fmt.Print(">>> ") reader := bufio.NewScanner(os.Stdin) for reader.Scan() { switch reader.Text() { ... ... This is quite convenient. However, I now want

[go-nuts] Re: Any alternative to go-bindata that supports dynamic assets?

2019-05-26 Thread Mark Bauermeister
, 26 May 2019 15:44:01 UTC+2, Mark Bauermeister wrote: > > My use case is a game engine that uses Lua scripts. > Naturally, Lua scripts can be changed during runtime without rebuilding > the entire project. > > Since go-bindata doesn't actually load the file during runtime bu

[go-nuts] Any alternative to go-bindata that supports dynamic assets?

2019-05-26 Thread Mark Bauermeister
My use case is a game engine that uses Lua scripts. Naturally, Lua scripts can be changed during runtime without rebuilding the entire project. Since go-bindata doesn't actually load the file during runtime but merely precompiles it to a string representation, it doesn't work for dynamic conten

[go-nuts] Go-SQLite3: Convert between string and slice

2019-05-05 Thread Mark Bauermeister
type Country struct { ID int`json:"id"` States string `json:"states"` } var Countries []Country func getAllCountries() { rows, err := db.Query("select id, states from countries") if err != nil { astilog.Error(err) } defer rows.Close() for rows.Next(

[go-nuts] Extend map with another map

2019-05-03 Thread Mark Bauermeister
t;Cloak of Darkness", Author: "Roger Firth (implemented by Mark Bauermeister)", Intro: `Hurrying through the rainswept November night, you're glad to see the bright lights of the Opera House. It's surprising that there aren't mor

[go-nuts] Re: Gomobile Reverse Bindings: Cannot import any android packages

2019-04-25 Thread Mark Bauermeister
hether/how I can reverse bind "com.facebook.react.bridge.ReactContextBaseJavaModule" on the Go side directly, so I can call "getReactApplicationContext()" directly from the Go side rather than pass the context in from Java. I know there's "-classpath" but how does it actually work for external J

Re: [go-nuts] Go if else syntax .. suggested replacement

2019-04-25 Thread Mark Volkmann
ly be confused by operators related to channels. If you allow people to use pointers, will they use pointers to pointers to pointers to pointers? On Thu, Apr 25, 2019 at 9:19 AM Sam Whited wrote: > On Wed, Apr 24, 2019, at 14:08, Mark Volkmann wrote: > > Are there really developers that

Re: [go-nuts] Go if else syntax .. suggested replacement

2019-04-24 Thread Mark Volkmann
f4a455e71b5f9fff79310/src/lib/libz/deflate.c#L597-L609 > > For those who don't want to follow those links this is the code from the > first URL above: > > lc_unicodeliterals = quote=='u' ? 1 : quote=='U' ? 0 : !!(ast.locale.set & > AST_LC_unicodeliterals

Re: [go-nuts] Go if else syntax .. suggested replacement

2019-04-24 Thread Mark Volkmann
t; > >>> > Ian >>> >>> -- >> 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+uns

Re: [go-nuts] Go if else syntax .. suggested replacement

2019-04-24 Thread Mark Volkmann
ted ternaries. R. Mark Volkmann Object Computing, Inc. > On Apr 24, 2019, at 8:58 AM, Jan Mercl <0xj...@gmail.com> wrote: > >> On Wed, Apr 24, 2019 at 3:48 PM L Godioleskky wrote: >> >> The lack of a Go ternary operator is at odds with Go's major theme of clean

[go-nuts] Re: Gomobile Reverse Bindings: Cannot import any android packages

2019-04-24 Thread Mark Bauermeister
is how. I already tried an OnCreate override func, but that one is somehow never called. On Wednesday, 24 April 2019 15:08:02 UTC+2, ma...@eliasnaur.com wrote: > > > > On Wednesday, April 24, 2019 at 2:34:34 PM UTC+2, Mark Bauermeister wrote: >> >> I'm currently exper

[go-nuts] Gomobile Reverse Bindings: Cannot import any android packages

2019-04-24 Thread Mark Bauermeister
I'm currently experimenting with Gomobile Reverse Bindings (my hope is to eventually be able to call getFilesDir(), so I can save my SQLite3 DB on mobile) and it is, quite literally, driving me insane. I've followed the sparse information available, was able to successfully work with 'import "Ja

Re: [go-nuts] Go if else syntax .. suggested replacement

2019-04-24 Thread Mark Volkmann
> On Apr 24, 2019, at 6:22 AM, Robert Engels wrote: > > Though to the ops point, not sure why Go doesn’t have the ternary operator - > which is pretty ubiquitous. The idea of adding the ternary operator to Go has been debated many times. It’s clear that those in charge have a strong dislike

Re: [go-nuts] When to use panic?

2019-01-03 Thread Mark Volkmann
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. > For more options, visit https://groups.google.com/

Re: [go-nuts] reflect Kind method

2018-12-24 Thread Mark Volkmann
Maybe it would be good to add an indication of just the basic type of each type in the index. For example, is the type a struct, interface, or something else? --- R. Mark Volkmann Object Computing, Inc. > On Dec 24, 2018, at 12:35 PM, Ian Lance Taylor wrote: > > On Mon, Dec 24, 2018

Re: [go-nuts] reflect Kind method

2018-12-24 Thread Mark Volkmann
n, Dec 24, 2018 at 12:04 PM Ian Lance Taylor wrote: > On Mon, Dec 24, 2018 at 9:29 AM Mark Volkmann > wrote: > > > > IIUC, Kind is a method of both Type and Value. But the index near the > top of https://golang.org/pkg/reflect/ only shows it as a method of > Value. If yo

[go-nuts] reflect Kind method

2018-12-24 Thread Mark Volkmann
the index excludes the Kind method in the list of Type methods? -- R. Mark Volkmann Object Computing, Inc. -- 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 e

Re: [go-nuts] Re: if/switch statements as expressions

2018-12-21 Thread Mark Volkmann
ld be expressions rather >> than statements. How would that negatively impact the language, in a way >> that can't already be reproduced? >> > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsu

[go-nuts] Re: Go 1.11.4 and Go 1.10.7 are released

2018-12-17 Thread mark
I think we're just waiting on this PR to get merged: https://github.com/docker-library/official-images/pull/5197 And then the official docker images should start building automatically. On Monday, December 17, 2018 at 1:27:01 PM UTC-5, Elliott Polk wrote: > > Will there be a Docker image update

Re: [go-nuts] Re: pass interface

2018-12-10 Thread Mark Volkmann
Thanks so much Dan! --- R. Mark Volkmann Object Computing, Inc. > On Dec 10, 2018, at 8:34 PM, Dan Kortschak wrote: > > https://play.golang.org/p/VWPb_AcgUrl > >> On Mon, 2018-12-10 at 20:14 -0600, Mark Volkmann wrote: >> Here is some code that shows a part of what I&

Re: [go-nuts] Re: pass interface

2018-12-10 Thread Mark Volkmann
} On Mon, Dec 10, 2018 at 3:28 PM Dan Kortschak wrote: > No, it is possible, but you need to pass the pointer to the interface. > You can then use reflect to interrogate the interface value. > > The bigger question, and one that would help here would be what is it > that you are a

Re: [go-nuts] Re: pass interface

2018-12-10 Thread Mark Volkmann
> > > > > понедельник, 10 декабря 2018 г., 5:05:12 UTC+3 пользователь Robert Engels > написал: >> >> I mean reflect.Type not a type that is an interface. >> >> On Dec 9, 2018, at 6:53 PM, Space A. wrote: >> >> Of course. When you "pass a

[go-nuts] pass interface

2018-12-09 Thread Mark Volkmann
Is it possible to pass an interface to a function in Go? I don’t want to pass a value whose type implements the interface, I want to pass the interface. -- R. Mark Volkmann Object Computing, Inc. -- You received this message because you are subscribed to the Google Groups "golang-nuts&q

[go-nuts] getting a reflect.Type for a type

2018-12-05 Thread Mark Volkmann
this: myThingType := reflect.TypeOf(new(MyThing)).Elem() I seems odd that I have to create one with new, getting a pointer to it, and then ask for the type of the thing in points to (with Elem) in order to get what I need. -- R. Mark Volkmann Object Computing, Inc. -- You received this message

[go-nuts] Is it possible with go modules to `go get` the ref (not the SHA) of an GitHub PR?

2018-12-04 Thread mark
I have a private github repository that depends on an open source github repository. There's an open PR in the open source repo, and I'd like to `go get` that change to test it locally in my private repo. Normally, when I update the open source repository, I can just run `go get github.com/MY_O

Re: [go-nuts] pointer dereference optimization in loops

2018-11-30 Thread Mark Volkmann
each loop iteration? On Fri, Nov 30, 2018 at 11:36 AM Jan Mercl <0xj...@gmail.com> wrote: > > On Fri, Nov 30, 2018 at 6:16 PM Mark Volkmann > wrote: > > > Will the Go compiler optimize the pointer dereference so it doesn't > happen in every loop iteration? If

[go-nuts] pointer dereference optimization in loops

2018-11-30 Thread Mark Volkmann
this? myValue := *myPtr for _, v := range values { fmt.Printf("%v %v\n", myValue, v) } -- R. Mark Volkmann Object Computing, Inc. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop rece

Re: [go-nuts] go language sensitive editor?

2018-11-20 Thread Mark Volkmann
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. > For more options, visit https://groups.google.com/d/optout. > -- R. Mark Volkma

Re: [go-nuts] [ANN] Koazee a library inspired by functional programming and lazy evaluation that takes the hassle out of working with arrays

2018-11-13 Thread Mark Volkmann
ved 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. >> For more options, visit https://groups.google.

  1   2   >