[go-nuts] Passing 2d arrays from Go to C using runtime.Pinner

2024-01-25 Thread Denis
I am trying to pass 2d array from Go to some C function void foo(in **float, out *double). Since I want to have wrapper for this C function, I'd like that Go function has definition like func FooWrapper([][]float32) []float64. The easiest but not efficient implementation is allocating all memor

[go-nuts] [go/types] Implements doesn't work for types from different packages when the interface signature has types from the package where the interface lies.

2018-05-04 Thread Denis Cheremisov
Hi! I am writing a special linting-like piece of code and struggle dealing with the Implements that doesn't work for my configuration. I made a simplified testing example to show the issue: - I have package speaker with interface Speaker and it

[go-nuts] Re: [go/types] Implements doesn't work for types from different packages when the interface signature has types from the package where the interface lies.

2018-05-04 Thread Denis Cheremisov
I meant true-false is not expected behaviour, true-true is what I would love to see. -- 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...@goog

[go-nuts] Re: [go/types] Implements doesn't work for types from different packages when the interface signature has types from the package where the interface lies.

2018-05-07 Thread Denis Cheremisov
ntation2 implements Interface", types.Implements(impl2, iface)) } Введите код... The problem though ASTs are not cached. I copied implementation of importer from go/internal/srcimporter and extended it with caching (I need ASTs besides *type.Package for style checks) суббота, 5 мая 2018 г.

[go-nuts] How to deal with binaries compilation with go modules enabled?

2018-08-30 Thread Denis Cheremisov
Hi! With Go 1.10 and earlier one can install binaries via regular `go get`, `go get golang.org/x/tools/cmd/goimports` for instance. It doesn't work with Go modules enabled: $ go get golang.org/x/tools/cmd/goimports go: cannot find main module; see 'go help modules' this is an obvious usability d

Re: [go-nuts] How to deal with binaries compilation with go modules enabled?

2018-08-30 Thread Denis Cheremisov
: > > > On Thu, 30 Aug 2018, at 3:37 PM, Denis Cheremisov wrote: > > Hi! > With Go 1.10 and earlier one can install binaries via regular `go get`, `go > get golang.org/x/tools/cmd/goimports` for instance. > It doesn't work with Go modules enabled: > > $ go get

Re: [go-nuts] How to deal with binaries compilation with go modules enabled?

2018-08-30 Thread Denis Cheremisov
aven't dug in > further. > > —Sam > > On Thu, Aug 30, 2018, at 13:29, Denis Cheremisov wrote: > > strange, still the same > > > > $ go get -x -u golang.org/x/tools/cmd/goimports > > go: cannot find main module; see 'go help modules'

Re: [go-nuts] How to deal with binaries compilation with go modules enabled?

2018-08-30 Thread Denis Cheremisov
oops, gave link to a dup, here's a right one: https://github.com/golang/go/issues/27380 четверг, 30 августа 2018 г., 22:06:36 UTC+3 пользователь Denis Cheremisov написал: > > Filled a new issue: https://github.com/golang/go/issues/27381 > Please let me know if a title is too wei

Re: [go-nuts] GoAWK: an AWK interpreter written in Go

2018-11-24 Thread Denis Cheremisov
> - also enable normal go program to use awk scripts probably this is better tool for the case суббота, 24 ноября 2018 г., 5:43:22 UTC+3 пользователь Tong Sun написал: > > > > On Saturday, November 17, 2018 at 12:44:57 PM UTC-5, Ben Hoyt wrote: >> >> >> https

[go-nuts] [dep] is it planned to integrate `go get` and future `go dep`?

2017-10-18 Thread Denis Cheremisov
Hi! I struggled a couple of days ago with an issue caused by the fact the *go get* is not aware of dependencies defined by the current *dep*, which I am using for the development purposes. *dep* sticked to fixed https://github.com/antlr/antlr4 version (latest, v4.7 released in march 2017), whil

[go-nuts] Where to store custom error values?

2017-11-24 Thread Denis Cosmin
I made an errors.go file containing all the error values for my application, it this approach ok or should I move the errors to the respective on which they relate? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group

[go-nuts] Re: Go 1.10 release candidate 1 is released

2018-01-26 Thread Denis Cosmin
Yay! On Thursday, January 25, 2018 at 11:26:42 PM UTC+2, Andrew Bonventre wrote: > > Hello gophers, > > We have just released go1.10rc1, a release candidate of Go 1.10. > It is cut from release-branch.go1.10 at the revision tagged go1.10rc1. > > Thank you to everyone who has helped to test Go 1

[go-nuts] The "leave "if err != nil" alone?" anti-proposal

2019-06-29 Thread Denis Cheremisov
The “try” proposal is unpopular: 246 dislikes vs 186 likes. And aforementioned one is highly popular with more than a thousand likes and the like/dislike ration is reaching 8 (actual numbers are 1147 likes vs 148 dislikes). And you must understand the specific: you are solving relatively hard p

[go-nuts] The "leave "if err != nil" alone?" anti-proposal

2019-06-29 Thread Denis Cheremisov
And prepare for wider audience in shitty “try” proposal after 1 July. -- 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

[go-nuts] Proposal: try function constructor

2019-06-29 Thread Denis Cheremisov
Pooof Are you serious? -- 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 https:

Re: [go-nuts] The "leave "if err != nil" alone?" anti-proposal

2019-07-01 Thread Denis Cheremisov
I think that it will become more readable than explicit error handling >> quite fast. Note that it is still explicit, if you don't use the try >> notation the error can be handled as it is now or ignored as it sometimes >> is now. >> >> I have a feeling t

[go-nuts] Re: VsCode syntax highlighting for tmpl files

2019-09-25 Thread Denis Bakhtin
This extension works well if templates have .gohtml extension. I had to rename mine. On Monday, September 23, 2019 at 7:25:52 PM UTC+4, cinem...@gmail.com wrote: > > Is there way to highlight templates files (.tmpl) in VSCode? There is an > extension gotemplate-syntax >

[go-nuts] Need advice on AST formatting

2019-10-17 Thread Denis Cheremisov
Hi! I have a utility that parses Go files into AST , makes some changes on the tree (import paths) and format it back into the Go source code, in the original file. The problem is I am using format.Node function from this package. The formatting this functio

Re: [go-nuts] Need advice on AST formatting

2019-10-26 Thread Denis Cheremisov
The answer was simple: var fset token.FileSet – wrong fset := token.NewFileSet() – right вторник, 22 октября 2019 г., 11:20:38 UTC+3 пользователь Michel Levieux написал: > > Hi Denis, > > In a project of my own I encountered the same issue. This program moves a > go pro

[go-nuts] [generics] (again). Type inference is somewhat weak

2020-06-17 Thread Denis Cheremisov
https://go2goplay.golang.org/p/ObL79WVHDjw Need to write types explicitly although all the info needed is easily accessible: fmt.Println(IsOK(*commonResponse, *commonError)(r)) What I am sure is I will keep using a code generator instead of this monstrosity. -- You received this message bec

[go-nuts] Re: [generics] Replace () with <> or other character

2020-06-17 Thread Denis Cheremisov
> > makes it easier to visual parse > Are you sure? It may be a personal thing, but "visual parsing" of these <<< really annoys me, I would prefer `[]`, but I like `()` more than `<>`. In addition, a good IDE (not that well known overhyped editor on steroids) will highlight these fragments, so

[go-nuts] Re: [generics]Use "<>" to declare template would be better than "()"

2020-06-17 Thread Denis Cheremisov
Better for who? You? I would to love to see `[]` instead of `()`, but `<>` are horrible to read IMO. среда, 17 июня 2020 г., 19:36:09 UTC+3 пользователь hao luo написал: > > The creator: > > Hi, I am extremely interested in and eager for golang's generics, and I > have read the updated draft.

[go-nuts] [generics] bring contracts back

2020-06-17 Thread Denis Cheremisov
IMO a groups of constraints are horrible with interfaces type CommonResponse(type E) interface { GetError() E } type CommonError interface { GetCode() int32 } func IsOK(type R CommonResponse(E), E CommonError)(r R) bool { switch r.GetError().GetCode() { case 0, 200, 201:

[go-nuts] [generics] why struct fields-based constraints were banned?

2020-06-17 Thread Denis Cheremisov
I can't get why struct based constraints were banned. struct is a kind of types in Go and a wish to only allow them having some field is valid. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving em

[go-nuts] Re: [generics] bring contracts back

2020-06-17 Thread Denis Cheremisov
There's an advantage though, for rather narrow cases though: reuse of interfaces: https://go2goplay.golang.org/p/HJr3QIzgQuX среда, 17 июня 2020 г., 19:58:08 UTC+3 пользователь Denis Cheremisov написал: > > IMO a groups of constraints are horrible with interfaces > > type Comm

[go-nuts] Re: [generics] bring contracts back

2020-06-17 Thread Denis Cheremisov
oops, an infitie loop in the As implementation, now the right one: https://go2goplay.golang.org/p/5NnZBnmIC96 среда, 17 июня 2020 г., 21:55:52 UTC+3 пользователь Denis Cheremisov написал: > > There's an advantage though, for rather narrow cases though: reuse of > interfa

[go-nuts] [generics] gRPC bistream quantization

2020-06-17 Thread Denis Cheremisov
Another question about generics, a HOWTODO one: I am bored to death writing methods what would send one request and get one response from a gRPC bistream. Decided to try a draft 2 against a generic approach to the task. My final attempt which I still can't compile: https://go2goplay.golang.org/

[go-nuts] Re: [generics] gRPC bistream quantization

2020-06-17 Thread Denis Cheremisov
Thank you -- 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 https://groups.googl

[go-nuts] Re: [generics] (again). Type inference is somewhat weak

2020-06-17 Thread Denis Cheremisov
lient, service.MethodRequest, service.MethodResponse)(ctx, client.Method, &service.MethodRequest{ … }) instead of simple to read resp, err := proto.ReadOne(ctx, client.Method, &service.MethodRequest{ … }) среда, 17 июня 2020 г., 19:43:35 UTC+3 пользователь Denis Cheremisov напис

[go-nuts] Re: [generics] Replace () with <> or other character

2020-06-18 Thread Denis Cheremisov
Not all languages use <> for parametric parametrism. I tried lots of variants and my favorite is [] from Scala (I don't like Scala, BTW). четверг, 18 июня 2020 г., 11:15:16 UTC+3 пользователь Nathanael Curin написал: > > An argument for this is also that (all ?) languages that use generics use

Re: [go-nuts] [generics] why struct fields-based constraints were banned?

2020-06-18 Thread Denis Cheremisov
It would be much less troublesome if you would keep using contracts instead of this interface insanity. четверг, 18 июня 2020 г., 3:18:05 UTC+3 пользователь Ian Lance Taylor написал: > > On Wed, Jun 17, 2020 at 10:05 AM Denis Cheremisov > > wrote: > > > > I ca

Re: [go-nuts] [generics] bring contracts back

2020-06-18 Thread Denis Cheremisov
ерг, 18 июня 2020 г., 1:11:22 UTC+3 пользователь Ian Lance Taylor написал: > > On Wed, Jun 17, 2020 at 9:58 AM Denis Cheremisov > > wrote: > > > > IMO a groups of constraints are horrible with interfaces > > > > type CommonResponse(type E) interface {

Re: [go-nuts] [generics] bring contracts back

2020-06-20 Thread Denis Cheremisov
h an interface you should write them all. - interface flood. There's a possibility to use them as an variable/paremeter/return value type although they are only needed for a generic contract. пятница, 19 июня 2020 г., 0:07:45 UTC+3 пользователь Denis Cheremisov

Re: [go-nuts] Generic syntax suggestions

2020-06-20 Thread Denis Cheremisov
I like it. Poor VSCode users will suffer from the current approach and all these ((() – this thing can't even highlight types of function parameters. Your variant is a lot (I mean a LOT) more readable Also, *[]T* and *map[K]V* does not look consistent, so I don''t think this is a true vali

Re: [go-nuts] Generic syntax suggestions

2020-06-20 Thread Denis Cheremisov
PS Also, *[]T* and *map[K]V* does not look consistent, so I don''t think this > is a true valid reason: I didn't mean they are inconsistent. They just don't look consistent at the first glance. суббота, 20 июня 2020 г., 19:06:14 UTC+3 пользователь Denis Cheremisov

[go-nuts] My small app executes within 400μs but the exit happens in about 0.16s

2020-07-04 Thread Denis Cheremisov
Hi! I have a small app like func main() { start := time.Now() … fmt.Println(time.Since(start)) } where output is ≈400μs but the actual time is about 0.16s, I mean $ time app-name real 0m0,156s user 0m0,238s sys 0m0,054s Profiling collects nothing (it is expected with ≈400μs of

Re: [go-nuts] My small app executes within 400μs but the exit happens in about 0.16s

2020-07-05 Thread Denis Cheremisov
0,001s sys 0m0,009s воскресенье, 5 июля 2020 г., 3:45:34 UTC+3 пользователь Kurtis Rader написал: > > On Sat, Jul 4, 2020 at 5:24 PM Denis Cheremisov > wrote: > >> I have a small app like >> >> func main() { >> start := time.Now() >> … >>

[go-nuts] Re: Generics and parentheses

2020-07-15 Thread Denis Cheremisov
Great! Those multiple parenthesis were a beat on unredable side indeed, and I always was in the pro-square party as I always found less and greater signs to be unreadable. As much as I disliked Scala in general I liked their generic syntax. This is a really good news Go will have the same. сред

Re: [go-nuts] Generics and parentheses

2020-07-15 Thread Denis Cheremisov
The big argument I always found less and greater signs to be not visually distinctive enough, at least with fonts I am using. [ and ] are larger and I was really happy with them in Scala although I dislike the language in general. Seriously though, the real big argument is [] are already used w

Re: [go-nuts] Re: Generics and parentheses

2020-07-16 Thread Denis Cheremisov
func 🍺X🍺GenericFunction(x X) … пятница, 17 июля 2020 г. в 01:25:29 UTC+3, kortschak: > On Thu, 2020-07-16 at 13:44 -0700, jpap wrote: > > Notwithstanding a concise unambiguous alternative, I would rather > > type parameters "stick out" so they are easily identified when > > visually scanning thr

Re: [go-nuts] Generics and parentheses

2020-07-22 Thread Denis Cheremisov
Lesser and greater signs never were a good choice. They were chosen because of C syntax restrictions. Go creators would do *slice[T]* (or may be just *[T]*), *map[K,V]*,* chan[T]*, etc if they had generics in mind. Because, if you have managed not to notice it, Go barely inherited anything from

Re: [go-nuts] Re: [generics] Feedback on optional type keyword experiment

2020-07-25 Thread Denis Cheremisov
I look at what Carla did write and it feels ... good. I don't know, it may be not for everyone, but for me [T any] looks cleaner than [type T]. Probably I see `[` and understand this is generic params, then `T` and I immediately understand this is how the generic type denoted. A final touch, I

Re: [go-nuts] Re: [generics] Feedback on optional type keyword experiment

2020-07-25 Thread Denis Cheremisov
Great catch! I would say I really like it! суббота, 25 июля 2020 г. в 23:37:39 UTC+3, Carla Pfaff: > I know it's common to have no constraints, but "[Elem any]" is even one > character shorter than "[type Elem]". I rewrote the function signatures > from slices.go2 in this way, and it doesn't f

Re: [go-nuts] Re: [generics] Feedback on optional type keyword experiment

2020-07-25 Thread Denis Cheremisov
Btw, it `any` suffix can be a part of grammar, I mean something like *GenericParam = Lit [',' Lit]* 'any' | Lit [',' Lit]* Ident* where *any* can be replaced with an actual *any* if there's one in a scope. воскресенье, 26 июля 2020 г. в 00:47:17 UTC+3, Denis C

[go-nuts] Re: How can I fork a module that uses /internal ?

2020-07-25 Thread Denis Cheremisov
As soon as I understand you can just keep their module name in `go.mod` and that's it. воскресенье, 26 июля 2020 г. в 03:46:15 UTC+3, brad.be...@gmail.com: > Hi folks. I was unable to find a good answer online already. The closest > I found was > https://stackoverflow.com/questions/14323872

Re: [go-nuts] Re: [generics] Feedback on optional type keyword experiment

2020-07-25 Thread Denis Cheremisov
I actually mean something different. The bad with *any* in builtins is there will be questions "why you use interface{}" if there's builtin *any?*", etc. I mean these will be different AST nodes, there will be *type GenericAny struct {* *Name *ast.Lit* *}* and *type Generic struct {* *

[go-nuts] Re: Thoughts on the try proposal (and Generics)

2020-07-28 Thread Denis Cheremisov
> Most functions are called more than once in a program, so adding > context to the implementation itself would benefit every caller: they don't > need to add the context themselves. This is highly questionable assumption. Context outside is obviously superior: - Your assumption just does no

Re: [go-nuts] Re: Why we don't have simple throws error statement

2020-08-02 Thread Denis Cheremisov
There are two major issues with Go error handling: 1. It is not strict enough, i.e. the compiler cannot ensure error check 2. It is not consistent enough. In the first you can easily ignore an error and the compiler will let you go further. In the second, you can both *if err := doSometh

Re: [go-nuts] A few thoughts on type parameters

2020-08-05 Thread Denis Cheremisov
> I think "[type T]" is slightly clearer than "[T any]". Code with `[T any]` is much easier to read at least for me. среда, 5 августа 2020 г. в 11:07:59 UTC+3, Jan Mercl: > On Tue, Aug 4, 2020 at 6:07 AM 'Carla Pfaff' via golang-nuts > wrote: > > > On Tuesday, 4 August 2020 at 00:34:12 UTC+2

Re: [go-nuts] Generics and parentheses

2020-08-08 Thread Denis Cheremisov
> Have the authors considered the implications of requiring the `type` keyword to use a generic type, not just at declaration time? Would this open up more syntax possibilities, such as `var x T`? This might be easier to read at the expense of five more characters of typing. It also could unify

Re: [go-nuts] Re: Why we don't have simple throws error statement

2020-08-18 Thread Denis Cheremisov
eturn err > } > > fmt.Println("result:", x + y + z) > > return nil > } > > How is sound? > > Semih. > On Sunday, 2 August 2020 at 11:44:43 UTC+3 Denis Cheremisov wrote: > >> There are two major issues with Go error handling: >&

Re: [go-nuts] [ generics] Moving forward with the generics design draft

2020-08-21 Thread Denis Cheremisov
BTW, I am really glad your proposal is accepted, now the whole thing feels polished and IMO it is time to start building an implementation. пятница, 21 августа 2020 г. в 20:02:17 UTC+3, Carla Pfaff: > On Friday, 21 August 2020 at 16:46:22 UTC+2 bbse...@gmail.com wrote: > >> All constraints exce

Re: [go-nuts] Re: How to know if interface{} data is nil w/o reflecting?

2020-08-23 Thread Denis Cheremisov
You may use something like this *value2 := *(*uint64)(unsafe.Pointer(uintptr(unsafe.Pointer(&value)) + 8))* *if value2 == 0 {* *return true* *}* on AMD64, should work also for any 64 bit architecture (at least I believe so). Remember though this is hacky

Re: [go-nuts] Re: [ generics] Moving forward with the generics design draft

2020-08-23 Thread Denis Cheremisov
I probably didn't read what you have wrote in the first message carefuly enough. Does it mean something like that will work type SomeTypes interface { type int, float32, float64 } func Min[T SomeTypes](x, y T) T { switch T { case int: if x < y {

Re: [go-nuts] [ generics] Moving forward with the generics design draft

2020-08-26 Thread Denis Cheremisov
> possibility of using angle brackets Please stop - call these operator signs “brackets” - pretending they are good in a role of brackets — they are not - spreading this nonsense from C syntax family of languages to saner once — yes, you heard it right. C is known for its chaotic de

Re: [go-nuts] rin: return if nil syntactic sugar

2020-08-31 Thread Denis Cheremisov
> I am using flutter and so Dart for the frontend right now, and I have come to a Error context has a little value in the end user apps, I noticed this too at the example of just CLI utilities. It is totally different when it comes to modern network systems, because there're far more places of

[go-nuts] Re: [ generics] Moving forward with the generics design draft

2020-09-04 Thread Denis Cheremisov
> But I don't think that using type list constraint as sum types is good idea. > Type constraints should be known in compile-time, but the sum type variant should be known in run-time. It looks like you misunderstand it a bit. Indeed type Constraint interface { type Type₁, Type₂, …, Typeₙ }

[go-nuts] Re: [ generics] Moving forward with the generics design draft

2020-09-05 Thread Denis Cheremisov
Oops, I meant "all interfaces can be used as a constraint yet there are interfaces that can be used as a value's 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 emai

Re: [go-nuts] how to use replace directives in go.mod in dev but not prod

2020-09-22 Thread Denis Cheremisov
CI probably is the anwser, made a utility based on golang.org/x/mod which parses go.mod and checks if replaces are there and exit with error state if they are. вторник, 22 сентября 2020 г. в 11:21:55 UTC+3, Paul Jolly: > 26640 is an open issue describing the same problem you're describing. >

Re: [go-nuts] Re: protobuf avoid namespace conflict

2020-09-30 Thread Denis Cheremisov
It is because you import protoc-gen-go generated entities with exactly the same package name and their own name. This is not allowed with protobuf, you can only have a single .. You can either use different names for error packages or use a 3rd repository with generated code. среда, 30 сентябр

[go-nuts] Licence details of github.com/golang/sync

2020-10-29 Thread Denis Cheremisov
Hi! At my job we found these additional patents limitatations https://github.com/golang/sync/blob/master/PATENTS They makes us impossible to use errgroup (which is, to say, turned to have pretty poor choice of WithContext signature, so our one is different), so we have our custom implementation

Re: [go-nuts] Licence details of github.com/golang/sync

2020-10-29 Thread Denis Cheremisov
ib is under the same note too, so we will have fun times :) четверг, 29 октября 2020 г. в 20:09:59 UTC+3, ohir: > Dnia 2020-10-29, o godz. 06:52:17 > Denis Cheremisov napisał(a): > > > Hi! > > At my job we found these additional patents > > limitatations https://gith

[go-nuts] My app hangs up at some point in net/http/h2_bundle.go. What is the better way to debug?

2020-11-09 Thread Denis Telyukh
idea why it happens. Which tools should I use to find the reason of such behaviour? Denis -- 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-nut

Re: [go-nuts] Re: My app hangs up at some point in net/http/h2_bundle.go. What is the better way to debug?

2020-11-09 Thread Denis Telyukh
hy it happens. Which tools >> should I use to find the reason of such behaviour? >> >> Denis > > -- > You received this message because you are subscribed to a topic in the > Google Groups "golang-nuts" group. > To unsubscribe from this topic, visit > htt

Re: [go-nuts] Re: My app hangs up at some point in net/http/h2_bundle.go. What is the better way to debug?

2020-11-10 Thread Denis Telyukh
More complex problem description with images: https://caddy.community/t/sometimes-http-2-request-hangs-up-need-help-with-debugging/10439/2 вторник, 10 ноября 2020 г. в 10:25:58 UTC+7, Denis Telyukh: > Thanks! Maybe it will help. > > вт, 10 нояб. 2020 г. в 01:21, seank...@

Re: [go-nuts] Re: My app hangs up at some point in net/http/h2_bundle.go. What is the better way to debug?

2020-11-10 Thread Denis Telyukh
ew the outgoing > queue sizes. > > On Nov 10, 2020, at 4:46 AM, Denis Telyukh > wrote: > > More complex problem description with images: > https://caddy.community/t/sometimes-http-2-request-hangs-up-need-help-with-debugging/10439/2 > > > вторник, 10 ноября 202

Re: [go-nuts] Re: My app hangs up at some point in net/http/h2_bundle.go. What is the better way to debug?

2020-11-10 Thread Denis Telyukh
well. > > On Nov 10, 2020, at 9:36 AM, Denis Telyukh wrote: > >  > > Thanks for your advice. But I have this problem on localhost also, I doubt > that problem in network capacity :-( > > вт, 10 нояб. 2020 г. в 19:09, Robert Engels : > >> You’ve most likely

Re: [go-nuts] Re: My app hangs up at some point in net/http/h2_bundle.go. What is the better way to debug?

2020-11-10 Thread Denis Telyukh
OS: Manjaro 20.2 Nibia Kernel: x86_64 Linux 5.4.74-1-MANJARO ср, 11 нояб. 2020 г. в 12:59, Kurtis Rader : > On Tue, Nov 10, 2020 at 9:39 PM Denis Telyukh > wrote: > >> 1. Got some stuck requests >> 2. netstat -atp >> tcp 25 0 dionysius-pc:52340

Re: [go-nuts] Re: My app hangs up at some point in net/http/h2_bundle.go. What is the better way to debug?

2020-11-12 Thread Denis Telyukh
Better problem description after deeper debugging: https://github.com/golang/go/issues/42534 среда, 11 ноября 2020 г. в 13:21:56 UTC+7, Denis Telyukh: > OS: Manjaro 20.2 Nibia > Kernel: x86_64 Linux 5.4.74-1-MANJARO > > ср, 11 нояб. 2020 г. в 12:59, Kurtis Rader : > >> On

Re: [go-nuts] Re: My app hangs up at some point in net/http/h2_bundle.go. What is the better way to debug?

2020-11-12 Thread Denis Telyukh
er when the buffers fill. > > I would continue to use the networking tools to diagnose. > > On Nov 12, 2020, at 3:22 AM, Denis Telyukh wrote: > > Better problem description after deeper debugging: > https://github.com/golang/go/issues/42534 > > среда, 11 ноября 2020

Re: [go-nuts] Re: My app hangs up at some point in net/http/h2_bundle.go. What is the better way to debug?

2020-11-12 Thread Denis Telyukh
> If you switch to http rather than http2 do you have the same issue? No, I haven't. > have you tried running your code under the race detector? Yes, I did. > Since you encounter it on localhost I assume you can extract what is needed based on the other issues cited. It's not easy, but I could t

[go-nuts] Re: Any recommendation for structured logging library in Golang?

2020-11-19 Thread Denis Cheremisov
Zerolog does the trick, need a bit of setup though for what you want среда, 18 ноября 2020 г. в 07:21:48 UTC+3, ChrisLu: > I am considering moving from glog to structured logging. I tried logrus, > go-kit, uber/zap, but could not find one good fit. In short, this is the > desired format: > > [

[go-nuts] [Macos/Apple M1] some fork/exec … operation not permitted error

2020-12-08 Thread Denis Cheremisov
Hi! I installed Go via sources $ go version go version devel +9c91cab0da Tue Dec 8 01:46:45 2020 + darwin/arm64 got better performance than I had with my aging Core i5 4670k, etc, this was expectable, no surprises here. But, there's an issue. When I call `go get`, `go install`, etc via `ex

[go-nuts] Re: [Macos/Apple M1] some fork/exec … operation not permitted error

2020-12-09 Thread Denis Cheremisov
Found what causes this. An extended Apple attribute apple.com.quarantine. Set it off, then need to set off some other utilities and now it is done. вторник, 8 декабря 2020 г. в 18:07:17 UTC+3, Denis Cheremisov: > Hi! I installed Go via sources > > $ go version > go version devel

[go-nuts] Re: Generating go code using go templates

2021-09-18 Thread Denis Cheremisov
Templates is the worst approach to code generation IMO. Take a look how they do this in protoc-gen-go: https://github.com/protocolbuffers/protobuf-go/blob/b92717ecb630d4a4824b372bf98c729d87311a4d/cmd/protoc-gen-go/internal_gengo/main.go#L83 I am using very similar approach, albeit I prefer forma

Re: [go-nuts] Re: Generating go code using go templates

2021-09-20 Thread Denis Cheremisov
en you have big files you can't check syntax >> easily, don't know how it looks and if you have errors in the template it >> is really hard to fix them. >> So the protoc-gen-go case is preferable. >> >> вс, 19 сент. 2021 г. в 04:33, Denis Cheremisov : >> >

[go-nuts] Re: Implement generic type interface

2022-01-25 Thread Denis Cheremisov
GoLand' support for generics is in alpha stage today, false negatives are pretty common and this is your case. понедельник, 24 января 2022 г. в 20:02:09 UTC+3, ka...@swit.io: > Before the question, I'm sorry I'm not good at English > > when go 1.18 beta released, i try to test generic type > M

[go-nuts] cannot initialize 1 variables with 2 values

2022-11-23 Thread Denis P
Hi guys, Does anyone know how to pass it properly and without adding extra lines of code? ``` func GetAsOr[T any](t interface{}, e error) (T, error) { return t.(T), e } func (s ServiceProvider) GetServiceOr() (interface{}, error) { } result := GetAsOr[MyObj](services.GetServiceOr()

[go-nuts] Method chaining in multiple lines

2022-11-24 Thread Denis P
Hi guys, I am struggling with making my code work in a way that multiple methods called in multiline approach. Does any gopher has an answer is there any solution to this: ``` type MyStuff struct { } func CreateMyStuff() MyStuff {} func (s MyStuff) DoJobOne() MyStuff {} func (s MyStuff) DoJob

[go-nuts] How to cast *interface{} into *T ?

2022-11-24 Thread Denis P
Hi guys, tried to look everywhere and cannot find an answer. So literally I have this: ``` var result interface{} = &MyStruct{} ... return result.(*MyStruct) // Error: invalid operation: result (variable of type *interface{}) is not an interface ``` Is there any way to get the &MyStruct as a

Re: [go-nuts] How to cast *interface{} into *T ?

2022-11-24 Thread Denis P
el.wa...@googlemail.com wrote: > Hi, > > > On Thu, Nov 24, 2022 at 11:16 PM Denis P wrote: > >> Hi guys, tried to look everywhere and cannot find an answer. >> >> So literally I have this: >> ``` >> var result interface{} = &MyStruct{} >> >>

Re: [go-nuts] How to cast *interface{} into *T ?

2022-11-24 Thread Denis P
Ok, finally got it: https://go.dev/play/p/QFQOpqWsR6S Thanks everyone, especially Axel On Thursday, 24 November 2022 at 23:14:27 UTC Denis P wrote: > Ok, looks like it doesn't work. > > I have got the following error: > panic: interface conversion: interface {} is MyStruct, not

Re: [go-nuts] How to cast *interface{} into *T ?

2022-11-25 Thread Denis P
Thank you everyone for your help. The problem still exists. I am looking for a solution where s and s2 point to the same instance. The current example proves they are different instances. https://go.dev/play/p/_JyfJelhIy4 The main goal is to store any type in a wrapper and then get the reference

Re: [go-nuts] How to cast *interface{} into *T ?

2022-11-28 Thread Denis P
quot;. It has "variables", which is >> *probably* what you mean. >> >> On Fri, Nov 25, 2022 at 10:55 AM Denis P wrote: >> >>> Thank you everyone for your help. >>> The problem still exists. >>> I am looking for a solution where s and s2

[go-nuts] Why do I get "The connection was reset" error when uploading a ~10MB file, and how to avoid reading the file into memory?

2024-08-02 Thread Denis Korovin
Hi everyone, I'm running into an issue with my Go server when trying to upload files around 10MB using a simple file upload form. In my browser, I'm seeing a "The connection was reset" error, and I'm not sure what is causing this problem or how to fix it. Here’s my current setup: https://go.d