[go-nuts] Testing that an implementation satisfies an interface in the standard library

2017-08-21 Thread Carl
Satisfying a standard interface like io.Reader or io.Writer correctly is not just a matter matching the function signatures, but rather adhering to behaviour that is documented in comments Is there a standard way for me to specify an implementation of such an

[go-nuts] A good indicator of code quality

2019-06-06 Thread Carl
I'd like to know what people are using to measure the quality of their Go code bases and why. Specifically, I'm asking if: 1. There is a way to score a code base on quality that works with idiomatic Go 2. Use this metric in a CI system and fail the build if the quality falls 3. Use t

[go-nuts] Re: Go 2 generics counterproposal: giving up restricting types

2019-06-06 Thread Carl
This proposal makes sense to me. Disclaimer: I don't know enough about language design to provide feedback on how it may be refined. This is just my perspective as a potential future user. 1. It is one of the simplest proposals I've read so far (but I have not read them all - there are

[go-nuts] Re: A good indicator of code quality

2019-06-09 Thread Carl
o Go, they're a pretty good indicator of technical debt at the design level. On Saturday, June 8, 2019 at 4:01:40 AM UTC+12, jake...@gmail.com wrote: > > On Thursday, June 6, 2019 at 3:58:19 PM UTC-4, Carl wrote: >> >> I'd like to know what people are using to measure the q

[go-nuts] Why were tabs chosen for indentation?

2017-03-19 Thread Carl
y were tabs chosen? I have no preference for tabs vs anything else, but I do respect the go team and the language designers and would really like to know the thinking behind the decision. Cheers, Carl -- You received this message because you are subscribed to the Google Groups "

Re: [go-nuts] Why were tabs chosen for indentation?

2017-03-19 Thread Carl
ion and everyone will see code indented as wide (or not) as they > prefer. > > In short, this is what the tab character is for. > > -rob > > > On Sun, Mar 19, 2017 at 1:50 PM, Carl > > wrote: > >> Hi, >> >> This is a question to whoever decide

Re: [go-nuts] DeepEqual of maps with pointers as keys (bug?)

2017-03-28 Thread Carl
Sorry to resurrect an old thread, but I just thought it worth mentioning that this is also the case if the key is a type from another package and the type contains an unexported pointer. Case in point: map[time.Time] I'm not sure how deep this goes - what i

[go-nuts] Changing wall clock in unit test

2021-07-29 Thread Carl
Hi, Is there a way to write a unit test that simulates a change in the wall clock for a time.Time value? Cheers, Carl -- 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 i

[go-nuts] Unit tests: Simulating a change in the system clock

2021-07-29 Thread Carl
Hi, I have a bug that is only triggered when the underlying system clock has changed. Is there a way to write a unit test to simulate this? Cheers, Carl -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this grou

Re: [go-nuts] Golang application local timezone doesn't change with the system timezone

2022-03-01 Thread Carl
timedatectl which updates /etc/timezone and /etc/localtime) If I had running services written in Go, they would not be aware of the timezone change. Questions I have: Why doesn't Go respect standard time zone changes? Is there a recommended way to address this? Cheers, Carl PS> I'm a

Re: [go-nuts] Golang application local timezone doesn't change with the system timezone

2022-03-01 Thread Carl
n...@ix.netcom.com wrote: > Have a background routine that polls the os every N secs - but the OP can > do that themselves. > > On Mar 1, 2022, at 5:32 PM, Kurtis Rader wrote: > >  > > On Tue, Mar 1, 2022 at 2:55 PM Carl wrote: > >> I would like to unders

[go-nuts] Re: GoLand 2019.1 EAP started today

2019-03-06 Thread carl . caulkett
Screenshot 2019-03-06 at 19.51.29.png] I'm running on macOS 10.14.2 Mojave and I'm not aware of having done any weird keyboard stuff here. Any ideas what the problem could be? Cheers, Carl On Thursday, January 24, 2019 at 8:34:22 PM UTC, Florin Pățan wrote: > > Hi gophers,

[go-nuts] Re: GoLand 2019.1 EAP started today

2019-03-06 Thread carl . caulkett
It's worth mentioning that I've tried displaying exactly the same piece of text in Goland 2018.3 and it displays totally correctly! [image: Screenshot 2019-03-06 at 20.47.02.png] I think it's fair to say that this is an issue in 2019.1 EAP. Cheers, Carl On Wednesday, March

[go-nuts] Re: Is this bad concurrency?

2017-08-18 Thread Carl Mastrangelo
FYI: It is possible for `done` to never be sent to. For example consider the following sequence: goroutine: ch <- 1 main: <- 1 main: run defer main: fin = atomic load goroutine: atomic store main: not 1, return On Friday, August 18, 2017 at 11:13:36 AM UTC-7, bill@talentinc.com wrote:

[go-nuts] Puzzle: make a sync.Once fire more than once

2017-11-19 Thread Carl Mastrangelo
Hi gophers, I was playing around with a puzzle trying to break the sync package and found something cool. Can you think of a definition for f that causes once.Do to execute the argument more than once? package main import ( "sync" ) func main() { var once sync.Once var f = // .

[go-nuts] totalling a column in a html template.

2016-08-25 Thread Carl Ranson
is to precalculate the totals and pass them as a struct to the template as well. thanks, Carl. -- 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 golan

[go-nuts] Re: totalling a column in a html template.

2016-08-26 Thread Carl Ranson
Ok, Thanks for the answers. I've gone down the route of adding totals to my data structure. cheers, CR. -- 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 gol

[go-nuts] Is SizedReaderAt coming back in 1.8?

2016-09-08 Thread Carl Mastrangelo
It seems that io.SizedReaderAt was added temporarily during the 1.7 cycle, but promptly removed. I see an standing github issue for it (15822) but it doesn't seem to have much activity. I would like to express my hope that it comes back (and hopefully others will to). A use case that I am i

[go-nuts] Wrong order for float64 conversion

2016-10-13 Thread Carl Mastrangelo
https://play.golang.org/p/iZTogUaWWl In the program above, foo and bar compile but baz does not. It fails with the message: "invalid operation: 1 << b (shift of type float64)". This seems to be wrong on the surface, since the order of operations should imply the shift takes precedence. In th

Re: [go-nuts] Wrong order for float64 conversion

2016-10-13 Thread Carl Mastrangelo
erand alone. > So in your baz() example, because 1 is an untyped constant, the shift > expression acts as if 1 is the only operand and converts it to a float64 > type; therefore, 1 has type float64 and you cannot shift. To get around > this, just use an explicitly typed constant. &g

[go-nuts] Is testing.M safe to run multiple times?

2016-10-24 Thread Carl Mastrangelo
Is it safe to call (*testing.M).Run() multiple times within a single TestMain ? Whether the answer is yes or no, would it be possible to update the docs to make this clear? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from t

[go-nuts] first program, game of life in go

2016-07-27 Thread Carl Ranson
HI all, So I figured Conways game of life would be a good exercise to get my feet wet with go. Specifically i wanted to make the calculation of the next board state to be concurrent. I started a separate goroutine for each cell and then used a pair of channels to synchronize updating to the

[go-nuts] Re: first program, game of life in go

2016-07-27 Thread Carl Ranson
Thanks Egon, Ok, I take your point that one needs to strike a balance with the work done in each goroutine to achieve optimum performance. i understand that each goroutine doing a subblock of the board using bitmaps would be faster, but as a learning exercise i'm keeping it simple. In fact I

[go-nuts] Re: first program, game of life in go

2016-07-28 Thread Carl Ranson
ok, fair enough. I guess I'm just used to thinking of concurrency in database terms where locking is involved. > > -- 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

[go-nuts] Re: first program, game of life in go

2016-07-28 Thread Carl Ranson
Anyone got any thoughts on the way I've used channels to synchronize things? Would I be much better off using chan bool instead of chan string for signaling? I've seen some code that suggests that chan interface{} is a valid. what can you send on that? thanks, CR -- You received this mes

[go-nuts] How long are the results from runtime.Callers valid?

2016-08-06 Thread Carl Mastrangelo
TL;DR: Is the uintptr slice returned from runtime.Callers always valid? Reading the docs* for runtime.Callers says: "Callers fills the slice pc with the return program counters of function invocations on the calling goroutine's stack. " Does this imply that once the goroutine is gone, or all

Re: [go-nuts] How long are the results from runtime.Callers valid?

2016-08-06 Thread Carl Mastrangelo
Cgo is not in use; thank you for the quick response! On Saturday, August 6, 2016 at 11:49:22 AM UTC-7, Ian Lance Taylor wrote: > > On Sat, Aug 6, 2016 at 10:08 AM, Carl Mastrangelo > > wrote: > > TL;DR: Is the uintptr slice returned from runtime.Callers always valid? > &g

[go-nuts] [ANN] HTTP/2 Plaintext Server

2017-06-02 Thread Carl Mastrangelo
Hi all, If you have ever wanted to use the Go httputil.ReverseProxy with HTTP/2, or do HTTP/2 over Unix Domain Sockets, or do gRPC over plaintext, I made a package that makes it easy to do: https://github.com/carl-mastrangelo/h2c I added some examples to show how to do it, comments welcome

Re: [go-nuts] Golang application local timezone doesn't change with the system timezone

2022-03-01 Thread Carl Menezes
Thanks. Makes sense. Cheers, Carl On Wed, Mar 2, 2022 at 1:09 PM Ian Lance Taylor wrote: > On Tue, Mar 1, 2022 at 4:05 PM Carl wrote: > > > > I'm interested in the reason for the current behaviour. > > I know there are ways to work around it and am aware of the con

[go-nuts] Re: A good indicator of code quality

2019-06-10 Thread carl . menezes . aeroqual
t; idiomatic Go, most programmers will have a prior history with other > languages that may impact how they code. Poorly designed heuristics may > penalize good programmers for not doing things in an inferior way. > > On Thursday, June 6, 2019 at 2:58:19 PM UTC-5, Carl wrote: >> &

[go-nuts] using interface{} values in C/C++ bindings

2024-04-08 Thread Carl-Philip Hänsch
Hi, I am currently developing a JITable interpreter for a scripting language where users can define user-defined functions with the signature func (...interface{}) interface{} that can interoperate with the scripts. interface{} can be bool, int, string, []interface{} or another func(...interfa

[go-nuts] Go JIT

2024-04-08 Thread Carl-Philip Hänsch
Hi, I saw in go's source code that all methods and data structures regarding parsers, the IR and so on are private. Is there a way to import go's parser and compiler as a library and start compiling .go files, building IR code at runtime and finally (with some implementation effort) JITing the

[go-nuts] Unsafe Pointer rules

2018-08-21 Thread &#x27;Carl Mastrangelo' via golang-nuts
(to short circuit any question, I have already read https://golang.org/pkg/unsafe/ ) If I create an unsafe.Pointer that points to an invalid memory address, but I never deference it or otherwise pass it along, what happens to it? Is it a valid go program to just create such a pointer? The mai

Re: [go-nuts] Unsafe Pointer rules

2018-08-21 Thread &#x27;Carl Mastrangelo' via golang-nuts
Tue, Aug 21, 2018 at 1:19 PM, 'Carl Mastrangelo' via golang-nuts > > wrote: > > > > If I create an unsafe.Pointer that points to an invalid memory address, > but > > I never deference it or otherwise pass it along, what happens to it? > > If you never

[go-nuts] syscall/js: How to pass data from the browser back into Go?

2018-10-05 Thread &#x27;Carl Mastrangelo' via golang-nuts
While trying out the Wasm compiler, I noticed that the syscall/js mainly has helper functions for converting Go types to Js types, but not the other way around. I am trying to read the data from an HTML . I add an event listener for the `change` event and want to read the file contents. The

[go-nuts] Can vet report useless assignments in method?

2018-10-22 Thread &#x27;Carl Mastrangelo' via golang-nuts
Hi go nuts, https://play.golang.org/p/ylYlbVMQ24- I recently hit an error where I had been calling methods on a struct. Originally, the fields in the struct were never changed, but after some iterations, i added some state to my struct. The methods which modified the state were always work