Re: [go-nuts] Re: Force pointer at compile time to interface{} parameter

2018-11-19 Thread Robert Engels
Interesting. I guess that makes sense. But you would think that if using a reflection call should force the compiler to heap allocate , then no reason for the restriction. > On Nov 19, 2018, at 2:33 PM, Ian Denhardt wrote: > > Quoting Robert Engels (2018-11-19 15:13:53) >>

Re: [go-nuts] Re: Force pointer at compile time to interface{} parameter

2018-11-19 Thread Robert Engels
have a concept of a "heap"). It's a > type-safety requirement. If you pass in a value, it can't be mutated, > full-stop. Reflect shouldn't allow you to bypass type-safety - only > "unsafe" can do that, hence the name. >> On Mon, Nov 19, 2018 at 9:51 PM R

Re: [go-nuts] Re: Force pointer at compile time to interface{} parameter

2018-11-19 Thread Robert Engels
n the struct to an interface that has the method you are > wanting to call. The following would compile under the rules you're > suggesting. It doesn't. > > https://play.golang.org/p/qRYPaDOPYsl > > >> On Mon, 2018-11-19 at 15:37 -0600, Robert Engels wrote: >

Re: [go-nuts] Re: Force pointer at compile time to interface{} parameter

2018-11-19 Thread Robert Engels
alue is based on the method signature, > which is readily available through the godoc. > >> On Mon, 2018-11-19 at 17:57 -0600, Robert Engels wrote: >> I understand that. I was stating that the syntactic sugar of >> automatic pointer creation to call a method should be removed

Re: [go-nuts] scanner.Text() every other character is null.

2018-11-20 Thread Robert Engels
Your file is probably utf16 so 2 byes for every character. > On Nov 20, 2018, at 1:28 PM, Alex Dvoretskiy wrote: > > > > file, err := os.Open(inputFile) > if err != nil { > log.Fatal(err) > } > defer file.Close() > scanner := bufio.NewScanner(file)

Re: [go-nuts] Re: scanner.Text() every other character is null.

2018-11-20 Thread Robert Engels
You can’t just “change the encoding”. You need to read the strings as utf16. See https://gist.github.com/bradleypeabody/185b1d7ed6c0c2ab6cec > On Nov 20, 2018, at 1:43 PM, Alex Dvoretskiy wrote: > > Yes, it's encoded in UCS-2, UTF-16. > > Should I just change encoding to UTF-8? > > What if I

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

2018-11-20 Thread robert engels
I used both VSCode and Intellij/GoLand. I suggest Intellij/GoLand for anything but trivial projects. The refactoring and navigation tools are far superior to those available in VS code, and it makes working in larger projects with lots of dependencies far easier IMO. > On Nov 20, 2018, at 3:15

Re: [go-nuts] google civic api

2018-11-20 Thread robert engels
You need to know the congressional district you were querying, in this case 3, then the parent key is: > ocd-division/country:us/state:wi/cd:3 and the full record > "ocd-division/country:us/state:wi/cd:3": { >"name": "Wisconsin's 3rd congressional district", >"officeIndices": [ > 3

Re: [go-nuts] Syntax highlighting (again) [WAS go language sensitive editor?]

2018-11-24 Thread robert engels
I would argue that good code reads in a linear manner - if it doesn’t it is a problem with the programmer or the language syntax/grammer. > On Nov 24, 2018, at 3:28 PM, Dan Kortschak > wrote: > > Thanks for bumping this. I had intended to respond. > > There is a fundamental difference between

Re: [go-nuts] Syntax highlighting (again) [WAS go language sensitive editor?]

2018-11-24 Thread robert engels
To add color, even highly concurrent and parallel designers are easy to read linearly if the constructs support it. > On Nov 24, 2018, at 4:06 PM, robert engels wrote: > > I would argue that good code reads in a linear manner - if it doesn’t it is a > problem with the progr

Re: [go-nuts] Syntax highlighting (again) [WAS go language sensitive editor?]

2018-11-24 Thread robert engels
t 4:15 PM, Ian Denhardt wrote: > > Quoting robert engels (2018-11-24 17:06:29) >> I would argue that good code reads in a linear manner - if it doesn’t >> it is a problem with the programmer or the language syntax/grammer. > > I think this is true on a small scale, but...

Re: [go-nuts] Is conversion between int and uint a no-op i.e. is it free

2018-11-24 Thread robert engels
This maybe true for Go, but not necessarily all languages. It might be implemented as result = original & 0x7FFF (for 32 bit int to uint) it depends on how the language specifies the conversion will occur. That being said, in Go the spec says: For the conversion of non-constant numeric val

Re: [go-nuts] Is conversion between int and uint a no-op i.e. is it free

2018-11-24 Thread robert engels
xtension and no subsequent truncation). > > What happens in other languages is largely irrelevant here (golang- > nuts). > > On Sat, 2018-11-24 at 18:16 -0600, robert engels wrote: >> This maybe true for Go, but not necessarily all languages. It might >> be implemente

Re: [go-nuts] Is conversion between int and uint a no-op i.e. is it free

2018-11-24 Thread robert engels
Although by the spec stating - sign extended - they are limiting Go to work on 2’s compliment platforms… > On Nov 24, 2018, at 6:48 PM, robert engels wrote: > > That is only the case if the platform uses 2’s compliment signed numbers - > which is almost certainly the case, but

Re: [go-nuts] Is conversion between int and uint a no-op i.e. is it free

2018-11-24 Thread robert engels
And as one overly anal person already pointed out - it is complement. > On Nov 24, 2018, at 6:50 PM, robert engels wrote: > > Although by the spec stating - sign extended - they are limiting Go to work > on 2’s compliment platforms… > >> On Nov 24, 2018, at 6

Re: [go-nuts] How to get request url scheme?

2018-11-24 Thread Robert Engels
That should be it... file a bug > On Nov 24, 2018, at 9:21 PM, Anik Hasibul wrote: > > Hi there! > I am working on a web application. And I need to get the scheme of the > request url. > I tried `req.URL.Scheme` it returned empty string. > But my expectation was `http` or `https` > > Any idea

Re: [go-nuts] Syntax highlighting (again) [WAS go language sensitive editor?]

2018-11-24 Thread robert engels
ation/signatures up as you move over the code. > On Nov 24, 2018, at 7:45 PM, Ian Denhardt wrote: > > Quoting robert engels (2018-11-24 17:34:34) >> Agreed, but that is why I have a big problem with variable inference as used >> in Go (and now Java 9 with var). >> &g

Re: [go-nuts] Syntax highlighting (again) [WAS go language sensitive editor?]

2018-11-24 Thread robert engels
structures. > On Nov 24, 2018, at 11:58 PM, Ian Denhardt wrote: > > Quoting robert engels (2018-11-25 00:15:21) > >> Contrast that with this actual code from the leading Go application (picked >> at random): >> >> func (p *pruner) prune(namespa

Re: [go-nuts] How to get request url scheme?

2018-11-25 Thread robert engels
GitHub! > > Here it is: https://github.com/golang/go/issues/28940 > <https://github.com/golang/go/issues/28940> > > Hasibul Hasan (Anik) > > Mobile: +8801902566424 > Email : anikhasi...@outlook.com <mailto:anikhasi...@outlook.com> > Github: @AnikH

Re: [go-nuts] Syntax highlighting (again) [WAS go language sensitive editor?]

2018-11-25 Thread Robert Engels
review their own python code that they wrote more than 30 days ago... very hard to follow. Btw, the code is part of k8s. > On Nov 25, 2018, at 11:58 AM, Ian Denhardt wrote: > > Quoting robert engels (2018-11-25 01:39:30) >> You kind of made my point, when you state “it’s eith

Re: [go-nuts] The most performant deque of all time?

2018-11-26 Thread robert engels
Just an FYI, IMO your testing is incorrect. Your tests should be in a package dequeue_test so that they cannot access the internal details. This makes them brittle and hard to follow. For reference, look at the Go stdlib sync/map.go and sync/map_test.go. All of the tests are in sync_test for al

Re: [go-nuts] The most performant deque of all time?

2018-11-26 Thread robert engels
est package as they are not supposed to access (or know of) > any of the deque internal variables. I'll move these tests to a different > file in the dequeue_test package. > > Really appreciate the suggestion (correction, really). > > Thanks, > Christian > &g

Re: [go-nuts] Re: is it possible to speed up type assertion?

2018-11-26 Thread robert engels
Why are you putting the ResetTimer() and StopTimer() calls in there ? Unnecessary AFAIK. Also, all this test is benchmarking is the time it takes to construct a Field struct. What is the point ? > On Nov 26, 2018, at 1:47 PM, lary...@gmail.com wrote: > > Talking about loggers and ZAP (interest

Re: [go-nuts] The most performant deque of all time?

2018-11-26 Thread robert engels
> the queue was performing correctly, but not efficiently. > > In any case, my point is a well validated implementation should have tests at > all levels (unit, integration, API, e2e) as some bugs can only be discovered > with some types of tests. > > On Mon, Nov 26, 2018

Re: [go-nuts] The most performant deque of all time?

2018-11-26 Thread robert engels
arguably non-idiomatic stdlib package does indeed > contain this kind of test). It also does not have in code asserts, > which are something that I've found to be very rare in Go code. > > On Mon, 2018-11-26 at 12:09 -0600, robert engels wrote: >> I am just offering, and many w

Re: [go-nuts] The most performant deque of all time?

2018-11-26 Thread robert engels
what should happen… And then some public methods like Do()/Move() are not tested at all. > On Nov 26, 2018, at 3:43 PM, robert engels wrote: > > My “none” looks to have been a little strong… Clearly whoever wrote the > container package believes in testing as the OP. A more in-

Re: [go-nuts] The most performant deque of all time?

2018-11-26 Thread robert engels
ckage. The tests > <https://github.com/ef-ds/deque>, package-wise, look as they should now. > Thanks Robert for the suggestion. :-) > > On Mon, Nov 26, 2018 at 2:01 PM robert engels <mailto:reng...@ix.netcom.com>> wrote: > It’s funny though, if you look at the container/ri

Re: [go-nuts] switch fallthrough as continue

2018-11-27 Thread Robert Engels
Breaks backwards compatibility as the switch may already be in a for loop and using continue... > On Nov 26, 2018, at 11:50 PM, Göcs Jëss wrote: > > We might as well reduce a one rarely used keyword > > continue means recommence or resume after interruption by google > > if a continue trigge

Re: [go-nuts] The most performant deque of all time?

2018-11-27 Thread robert engels
to spared links. I really appreciate the help, Roger >> (@rogpeppe), for pointing out and helping fix the bug. >> >> On Mon, Nov 26, 2018 at 8:07 PM robert engels > <mailto:reng...@ix.netcom.com>> wrote: >> No problem, but just one last word on this… >&

Re: [go-nuts] The most performant deque of all time?

2018-11-27 Thread Robert Engels
loc, > similarly in json where decode_test.go is 1920 sloc and decode.go is > 971. > > Dan > >> On Tue, 2018-11-27 at 21:40 -0600, robert engels wrote: >> If the tests are internal, you technically needs tests for the tests >> - based on LOC there is more

[go-nuts] [ANN] fixed point math library

2018-11-28 Thread robert engels
For those interesting in financial apps, I have released ‘fixed' at https://github.com/robaho/fixed a high performance fixed-point math library primarily designed for to work with currencies. The benchmarks: (Decimal is the shopspring library, big Int/Float are

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread Robert Engels
Thanks for the feedback. My comments below. > - To me type name 'fixed.Fixed' sounds like Javaism. Go code usually tries to > avoid such stutter: 'sort.Interface', 'big.Int' etc. > To me that’s a limitation of Go with small packages like this that only have a single public struct. It is based

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread Robert Engels
N. > I think it would be more consistent if fixed.Cmp() would return NaN if any of > it's operands are NaN. > > just my 2ct > messju > > >> On Thu, Nov 29, 2018 at 12:47:05AM -0600, robert engels wrote: >> For those interesting in financial apps, I have rele

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread Robert Engels
Also, the most important reason against the setters - a Fixed is immutable. > On Nov 29, 2018, at 7:00 AM, Robert Engels wrote: > > Thanks for the feedback. My comments below. > >> - To me type name 'fixed.Fixed' sounds like Javaism. Go code usually tri

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread Robert Engels
lt;0xj...@gmail.com> wrote: > > On Thu, Nov 29, 2018 at 2:00 PM Robert Engels wrote: > > > >> - To me type name 'fixed.Fixed' sounds like Javaism. Go code usually tries > >> to avoid such stutter: 'sort.Interface', 'big.Int' etc. > &

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread Robert Engels
Can't see a way to create from an integer (other than convert to float) >> - Personally I'd rather not see a NewS() which can silently fail with no >> info, I'd prefer to rename NewSErr to Parse and remove NewS. >> >> Other than that, pretty cool. >> >

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread Robert Engels
Technically, a NaN in comparison with any other including NaN is false. For Cmp this creates a problem > On Nov 29, 2018, at 7:41 AM, Robert Engels wrote: > > Ah, you want a ctor that is the int value. Ok. The Raw doesn’t do this > anyway... I could add a NewI() ctor but I’m

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread Robert Engels
Btw, thus includes == when using NaN and float64. It’s strange but that’s the way it’s defined. > On Nov 29, 2018, at 7:46 AM, Robert Engels wrote: > > Technically, a NaN in comparison with any other including NaN is false. For > Cmp this creates a problem > >> On

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread Robert Engels
files and constants. I think the scaled ctor is a fine addition though. > On Nov 29, 2018, at 7:56 AM, Jan Mercl <0xj...@gmail.com> wrote: > > On Thu, Nov 29, 2018 at 2:41 PM Robert Engels wrote: > > > > Ah, you want a ctor that is the int value. Ok. The Raw doesn’t do

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread Robert Engels
:20 AM, Jan Mercl <0xj...@gmail.com> wrote: > > On Thu, Nov 29, 2018 at 3:07 PM Robert Engels wrote: > > > Wait, you support type inference and not dot imports... I think you should > > revisit this opinion... > > I believe it's the other way around. Se

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread Robert Engels
That being said, I am not sure why I can use the qualified package name when I have a dot import. This would be helpful for method collision like New() > On Nov 29, 2018, at 8:35 AM, Robert Engels wrote: > > I am not referring to variable declarations I am referring to > >

Re: [go-nuts] GORM, saving values

2018-11-29 Thread Robert Engels
If gorm is like json marshalling the fields need to be exported, that is capitalized. Just a thought. > On Nov 29, 2018, at 12:02 AM, mmbarighz...@gmail.com wrote: > > New to Go - please bear with me. > > I am trying to create a new row in my table, but the values are being saved > as `Null

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread robert engels
> > In the majority of cases compression does not reduce the number of bits > of information (appreciably). > > On Thu, 2018-11-29 at 08:35 -0600, Robert Engels wrote: >> And since you like lingo, more bits of information is not always a >> good thing. That’s why we have comp

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread robert engels
Would you elaborate? I’ve read the discussion multiple times, and can’t see what other bits you think he is referring to. > On Nov 29, 2018, at 3:07 PM, Jan Mercl <0xj...@gmail.com> wrote: > > > On Thu, Nov 29, 2018 at 10:02 PM robert engels <mailto:reng...@ix.netcom.co

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread robert engels
, 0x1. > > On Thu, 2018-11-29 at 22:07 +0100, Jan Mercl wrote: >> On Thu, Nov 29, 2018 at 10:02 PM robert engels >> >> wrote: >> >>> >>> I’m pretty sure that is not correct, see >> https://www.maximumcompression.com >>> >>&g

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread robert engels
re is room to add additional information; fixed.Number. > > Thanks for playing! > > On Thu, 2018-11-29 at 16:24 -0600, robert engels wrote: >> Right and since fixed.Fixed can be reduced to Fixed with no loss of >> information, it is a great lossless compression - more than 50

Re: [go-nuts] [ANN] fixed point math library

2018-11-29 Thread Robert Engels
var m2 = $(10) > var m3 = £(2) > > m1 + m2 // ok > m2 + m3 // compile time error > m1*m2 // compile time error > m1*5 // ok > m1+5 // compile time error > > I doubt go2 will get generics flexible enough for this! > ] > >> On Nov 28, 2018, at 10:47 PM, ro

Re: [go-nuts] Scaling websockets

2018-11-30 Thread Robert Engels
It is not a websocket issue it is a design issue. Either the notification service needs to subscribe to the MQ channel for each user logged into that service, or it needs to subscribe for a group of users, or all users. Sounds like you are doing all users, and it is not working but you don’t sa

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

2018-11-30 Thread robert engels
It’s as simple as: var count = 1 var p = &count func X() { total :=0 for i:=0; i <100;i++ { total = total + *p } } no ? > On Nov 30, 2018, at 11:48 AM, Mark Volkmann wrote: > > I think I failed to come up with a good code example. But suppose I need to > do something with a point

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

2018-11-30 Thread robert engels
I would think the compiler would be free to optimize this as a single load outside the loop - as Go has no volatile declaration (to inform the compiler that some other thread might of changed the value of *p) > On Nov 30, 2018, at 11:58 AM, robert engels wrote: > > It’s as simple as:

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

2018-11-30 Thread robert engels
… { > total += *p > } > > but I wouldn’t bet on it in > > for … { > total += *p > foo() > } > > //jb > >> On 30 Nov 2018, at 19:01, robert engels > <mailto:reng...@ix.netcom.com>> wrote: >> >> I would think the compiler woul

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

2018-11-30 Thread robert engels
maybe it’s optimized in >> >> for … { >> total += *p >> } >> >> but I wouldn’t bet on it in >> >> for … { >> total += *p >> foo() >> } >> >> //jb >> >> On 30 Nov 2018, at 19:01, robert engels wrote: >

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

2018-11-30 Thread robert engels
According to Dobb’s, http://www.drdobbs.com/cpp/type-based-alias-analysis/184404273 <http://www.drdobbs.com/cpp/type-based-alias-analysis/184404273>, many compilers do this today to some degree. > On Nov 30, 2018, at 2:51 PM, robert engels wrote: > > I’m not so sure about

Re: [go-nuts] [ANN] fixed point math library

2018-12-01 Thread Robert Engels
hash.Function? Then you need print.Function. So soon enough there will be a 1000 interfaces named Function that have nothing to do with hashing or printing because everything can be decomposed that way. context.Frame? Now you’re just being silly. You might as well use context.Instance or even

Re: [go-nuts] [ANN] fixed point math library

2018-12-01 Thread Robert Engels
fruit that should be corrected in Go 2 that should be easily agreed upon. > On Dec 1, 2018, at 6:53 AM, Robert Engels wrote: > > hash.Function? Then you need print.Function. So soon enough there will be a > 1000 interfaces named Function that have nothing to do with hashing or

Re: [go-nuts] [ANN] fixed point math library

2018-12-01 Thread Robert Engels
compatibility. > On Dec 1, 2018, at 7:04 AM, Robert Engels wrote: > > And while we’re at it, take a closer look at the hash package > https://golang.org/pkg/hash/#Hash > > Especially the example and the doc surrounding it. > > Why doesn’t Hash “extend” the binary marshall int

Re: [go-nuts] [ANN] fixed point math library

2018-12-01 Thread Robert Engels
This is a problem with it seems more than a few in this community. Someone makes a criticism of an idea, backs it up, and is treated in a childish manner because it doesn’t go along with dominate opinions of the controllers of the group think. Not good IMO. > On Dec 1, 2018, at 7:48 AM, Jan Me

Re: [go-nuts] [ANN] fixed point math library

2018-12-01 Thread Robert Engels
c 1, 2018, at 8:00 AM, Robert Engels wrote: > > This is a problem with it seems more than a few in this community. Someone > makes a criticism of an idea, backs it up, and is treated in a childish > manner because it doesn’t go along with dominate opinions of the controllers >

[go-nuts] Package Stutter

2018-12-01 Thread Robert Engels
In another thread, it has been brought up that things like time.Time are no good. But this format is pervasive. Even newer packages like context.Context. It seems to have been this way for a long time. It there some reasoned paper on why this is now so frowned upon? -- You received this messa

Re: [go-nuts] [ANN] fixed point math library

2018-12-01 Thread Robert Engels
;> use-cases, and other kinds of supporting information so that the >> conversation moves from "i feel that" ==> "in these situations" ==> "a >> workable resolution" ==> ... ==> "X seems the best way forward after much >> analysis.

Re: [go-nuts] Package Stutter

2018-12-01 Thread Robert Engels
rliest practitioners. It > doesn't mean the idea does not have merit though. > >> On Sat, 1 Dec 2018, 14:19 Robert Engels, wrote: >> In another thread, it has been brought up that things like time.Time are no >> good. But this format is pervasive. Even newer packages l

Re: [go-nuts] Package Stutter

2018-12-01 Thread Robert Engels
are saying, each case is unique and having a “rule” is too restrictive. Good software design is applying patterns reasonably not as a matter of rules IMO. > On Dec 1, 2018, at 11:57 AM, Ian Lance Taylor wrote: > >> On Sat, Dec 1, 2018 at 9:53 AM Robert Engels wrote: >> &g

Re: [go-nuts] Package Stutter

2018-12-01 Thread Robert Engels
line: think of "reduce stutter" as a *best practice* but not a *rule*! > >> On Dec 1, 2018, at 9:53 AM, Robert Engels wrote: >> >> That was my point. The earliest practitioners and language designers used >> the construct extensively but now others claim it

Re: [go-nuts] Package Stutter

2018-12-01 Thread Robert Engels
e common short name for channel > variables. Since we typically use the short name ctx, we also considered the > type name context.Ctx, but this seemed too arbitrary. We went with > context.Context because it's clear and doesn't introduce any unnecessary > confusion. > S

Re: [go-nuts] Package Stutter

2018-12-01 Thread Robert Engels
suspecting it’s because people’s packages are too large in scope so they end importing tons of external packages. It’s a structure problem not a language feature problem. > On Dec 1, 2018, at 11:08 PM, Ian Denhardt wrote: > > Quoting Robert Engels (2018-12-01 22:25:06) > >> The wa

Re: [go-nuts] Package Stutter

2018-12-01 Thread robert engels
ldn’t be used - but I making a blanket statement its bad seems like overreach. > On Dec 1, 2018, at 11:19 PM, Robert Engels wrote: > > I know everyone hates it when I reference java but it has had dot imports at > the package level since day one. I won’t repeat why that matte

Re: [go-nuts] Package Stutter

2018-12-01 Thread robert engels
list = Collections.singletonList(someobject) otherwise you need to write the code as: java.util.List list = java.util.Collections.singletonList(someobject); > On Dec 1, 2018, at 11:51 PM, Ian Denhardt wrote: > > Quoting Robert Engels (2018-12-02 00:19:40) >> I know everyone

Re: [go-nuts] Package Stutter

2018-12-01 Thread robert engels
import is used for constants, although for some types of routines it is used to make the code read like a DSL. > On Dec 2, 2018, at 12:04 AM, robert engels wrote: > > The .* doesn’t mean what you think it does - that just means all of the > classes in the package. It is no di

Re: [go-nuts] Package Stutter

2018-12-01 Thread robert engels
wouldn’t refer to it at com.google.common.collect.ImmutableList, you would import it, and use ImmutableList. Which brings me back to why the ‘stutter’ is useful - it allows dot imports to work, without it they cannot. > On Dec 2, 2018, at 12:04 AM, robert engels wrote: > > The .* doe

Re: [go-nuts] Package Stutter

2018-12-01 Thread robert engels
I think it is especially problematic for python because: import * + type inference + dynamic language = hell in my book. > On Dec 2, 2018, at 12:26 AM, Ian Denhardt wrote: > > Quoting robert engels (2018-12-02 00:59:31) > >> Granted, their package structure seems poor

Re: [go-nuts] Package Stutter

2018-12-01 Thread robert engels
I was thinking the similarly, which is why I thought about the List case. In Java, however you get there, it is just referred to as List In Go, it is going to be list.List And in a competing implementation it is going to be container.List or whatever package the author came up with. That’s a b

Re: [go-nuts] Package Stutter

2018-12-02 Thread Robert Engels
ports, but then in your next post you say that they're > mainly used for constants, "although for some types of routines it is > used to make the code read like a DSL." > > > >> On Sun, 2018-12-02 at 00:04 -0600, robert engels wrote: >> When you us

Re: [go-nuts] Package Stutter

2018-12-02 Thread Robert Engels
decisions. > On Dec 2, 2018, at 10:56 PM, Ian Lance Taylor wrote: > >> On Sat, Dec 1, 2018 at 7:25 PM Robert Engels wrote: >> >> The way to fix it though it just to use dot imports, and encourage it! The >> only time dot imports don’t work is when there isn’t packag

Re: [go-nuts] Package Stutter

2018-12-02 Thread robert engels
or local function wrappers (mid-stack > inlining should make that zero-cost at some point). > > FYI I have created a Go proposal related to this that you might wish to give > feedback on: > https://github.com/golang/go/issues/29036#issuecomment-443311975 > <https://gith

Re: [go-nuts] Package Stutter

2018-12-03 Thread Robert Engels
is noise. Everyone working on the application knows that Employee means model.Employee. It is part of the language (dsl in a way) for that application. > On Dec 3, 2018, at 5:31 AM, Bakul Shah wrote: > >> On Dec 2, 2018, at 11:39 PM, robert engels wrote: >> >> w

Re: [go-nuts] Package Stutter

2018-12-03 Thread Robert Engels
I thought the main was special cased, since the app band is based on the directory not the package. > On Dec 3, 2018, at 3:04 AM, roger peppe wrote: > > On Mon, 3 Dec 2018 at 07:40, robert engels wrote: > > Roger, > > > > I experimented with the import name (r

Re: [go-nuts] Package Stutter

2018-12-03 Thread Robert Engels
qualified. You have a similar problem if both applications have a model package. Now you need to override the import on one of them. No difference IMO. > On Dec 3, 2018, at 10:03 AM, Bakul Shah wrote: > >> On Dec 3, 2018, at 6:52 AM, Robert Engels wrote: >> >

Re: [go-nuts] Package Stutter

2018-12-03 Thread Robert Engels
Anyway, thanks all for the input. I am continuing to review other large code based for real world examples for what works and what doesn’t and having the input of the community makes understanding the conventions easier. > On Dec 3, 2018, at 10:08 AM, Robert Engels wrote: > > I u

Re: [go-nuts] Package Stutter

2018-12-03 Thread Robert Engels
gt; On Dec 3, 2018, at 8:08 AM, Robert Engels wrote: >> >> I understand that, and when working in code that uses both types, which is >> probably limited, you fully qualify. This is pretty standard stuff in the >> enterprise world, as well architected solutions are segment

Re: [go-nuts] Best way to handle database transactions? (commit, or rollback on error)

2018-12-03 Thread Robert Engels
How can you write this err := InsertFoo(tx) Don’t you get no new variables defined error here? > On Dec 3, 2018, at 3:53 PM, Ben Hoyt wrote: > > Hi folks, > > We found some subtle bugs in our db transaction code for handling > commits/rollbacks. Here's the pattern we were using (not real, bu

Re: [go-nuts] Best way to handle database transactions? (commit, or rollback on error)

2018-12-03 Thread Robert Engels
s of trying to modify the code snippet from > our actual code on the fly. It was more like: > > t, err := InsertFoo(tx) > > -Ben > > >> On Mon, Dec 3, 2018, 5:50 PM Robert Engels > How can you write this >> >> err := InsertFoo(tx) >> >>

Re: [go-nuts] Package Stutter

2018-12-03 Thread Robert Engels
want to stir the hornets nest at this point, the community has exhausted me a bit... > On Dec 3, 2018, at 3:46 PM, Burak Serdar wrote: > >> On Sun, Dec 2, 2018 at 11:09 PM Robert Engels wrote: >> >> I agree that is an important consideration, but it seems less impor

Re: [go-nuts] Package Stutter

2018-12-03 Thread Robert Engels
Btw, I am working on some issues/proposals/tools that I think will help the situation - not just complaining. > On Dec 3, 2018, at 5:19 PM, Robert Engels wrote: > > Probably another thread unto itself, and some of the issues have already been > corrected like the additio

Re: [go-nuts] Re: Best way to handle database transactions? (commit, or rollback on error)

2018-12-03 Thread Robert Engels
Go vet will report this as a problem. > On Dec 3, 2018, at 5:54 PM, Ben Hoyt wrote: > > Robert, here is code (actual working code this time) similar to what we have: > https://play.golang.org/p/jUPqgnk6Ttk > > Leonel, yep, I understand that, which is why we have this problem. The thing > is,

Re: [go-nuts] Koazee vs Go-Linq vs Go-Funk

2018-12-04 Thread Robert Engels
Shouldn’t this code be index = index+ 2 for index := 0; index < (len/2)+1; index++ { output[index], output[len-1-index] = input[len-1-index], input[index] } And the loop needs to go to Len - you are only copying half the elements > On Dec 4, 2018, at 5:27 AM, Iván Corrales Solera > wrote: >

Re: [go-nuts] Koazee vs Go-Linq vs Go-Funk

2018-12-04 Thread Robert Engels
Sorry, I see it is going from both ends... too early :) > On Dec 4, 2018, at 8:33 AM, Robert Engels wrote: > > Shouldn’t this code be index = index+ 2 > > for index := 0; index < (len/2)+1; index++ { > output[index], output[len-1-index] = input[len-1-index], input[inde

[go-nuts] build go in Intellij

2018-12-04 Thread robert engels
Hi, anyone on the list know how, or can point me to documentation, on building Go itself in Intellij? By that I mean, I want to make changes to the standard lib, or tools (specifically trace), and just compile that tool, tests, etc, work in Intellij. Right now, when I fork golang/go and open in

Re: [go-nuts] build go in Intellij

2018-12-04 Thread robert engels
I also get errors like: even though the strings package shows a being imported correctly. > On Dec 4, 2018, at 6:37 PM, robert engels wrote: > > Hi, anyone on the list know how, or can point me to documentation, on > building Go itself in Intellij? > > By that I me

Re: [go-nuts] I want to set the position of the window in GUI display of golang

2018-12-04 Thread Robert Engels
You should probably file an issue at http://github.com/lxn/walk They don’t seem to have a community forum, but I think the author could help you easily. Also you could try stack overflow as there are a few questions about this library there. > On Dec 4, 2018, at 7:44 PM, mdi.k...@gmail.com w

Re: [go-nuts] navigating through interface calls

2018-12-07 Thread Robert Engels
IntelliJ has “show implementations” which will do what you want. > On Dec 7, 2018, at 11:13 AM, Burak Serdar wrote: > > On Fri, Dec 7, 2018 at 9:53 AM David Wahlstedt > wrote: >> >> Hi, >> I am still quite inexperienced in go programming, and I find it quite >> frustrating, sometimes, to fin

Re: [go-nuts] pass interface

2018-12-09 Thread Robert Engels
Just declare the parameter as type Type and then in the method check if it is an interface. The caller uses the interface type. > On Dec 9, 2018, at 2:43 PM, Jan Mercl <0xj...@gmail.com> wrote: > > On Sun, Dec 9, 2018 at 9:23 PM Mark Volkmann > wrote: > > > Is it possible to pass an interf

Re: [go-nuts] Re: pass interface

2018-12-09 Thread 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 value whose type implements the interface" as an > interface argument to a function, you in fact pass an interface. > > > воскресенье, 9 декабря 2018 г., 23:23:4

Re: [go-nuts] Re: pass interface

2018-12-09 Thread Robert Engels
p;i).Elem()) > } > > Output: > is interface, with value: test > reflect.Type is interface {} > > > > > > понедельник, 10 декабря 2018 г., 5:05:12 UTC+3 пользователь Robert Engels > написал: >> >> I mean reflect.Type not a type that is an interf

Re: [go-nuts] Re: navigating through interface calls

2018-12-10 Thread Robert Engels
When using IntelliJ, did you restrict the search to “project files”? Otherwise you will get implantations anywhere in the standard library or other projects. > On Dec 10, 2018, at 6:21 AM, David Wahlstedt > wrote: > > Hi, and thanks for your answers! > Yes, I realize that the possible results

Re: [go-nuts] Http server, async tasks and gracefully shutdown.

2018-12-10 Thread Robert Engels
>From the docs: Note that calls with a positive delta that occur when the counter is zero must happen before a Wait. Calls with a negative delta, or calls with a positive delta that start when the counter is greater than zero, may happen at any time. Typically this means the calls to Add should

Re: [go-nuts] Is there a good approach to abstraction of DB access including transactions and forupdate?

2018-12-10 Thread Robert Engels
Distributed transactions are difficult in cloud computing. See GCP Spanner. Also read up on “saga” pattern. If you have multiple sources participating in the transaction, saga seems to be the preferred method for highly scalable solutions. > On Dec 10, 2018, at 8:55 AM, bonpi bonpi wrote: >

Re: [go-nuts] timeout with bufio.Scanner & Scanner.Scan()

2018-12-10 Thread robert engels
You need to use multiple go routines and channels - one routine calls Scan() and when it gets the result it writes it to a channel, then the reader can timeout on the channel. > On Dec 10, 2018, at 4:26 PM, Trig wrote: > > I'm currently reading ASCII data from a serial port using the bufio.Sca

Re: [go-nuts] Re: pass interface

2018-12-10 Thread Robert Engels
ger question, and one that would help here would be what is >>> it >>> that you are actually trying to achieve. >>> >>>> On Mon, 2018-12-10 at 08:53 -0600, Mark Volkmann wrote: >>>> >>>> Yes, this is what I'm

Re: [go-nuts] build go in Intellij

2018-12-11 Thread robert engels
ber 5, 2018 at 1:42:01 AM UTC+1, robert engels wrote: > I also get errors like: > > > > even though the strings package shows a being imported correctly. > >> On Dec 4, 2018, at 6:37 PM, robert engels > wrote: >> >> Hi, anyone on the list know how, or can poin

Re: [go-nuts] Pause failures, GC, & StopTheWorld

2018-12-11 Thread robert engels
I think it would be more helpful if you used gctrace=1 to report on the GC activity. > On Dec 11, 2018, at 3:37 PM, e...@kasten.io wrote: > > I am observing pause failures in an application and it appears to me that I’m > seeing it take from 5 to 28 seconds or more for the StopTheWorld to take

<    1   2   3   4   5   6   7   8   9   10   >