Re: [go-nuts] Too many open files / broken pipe issue.

2020-05-08 Thread Steven Hartland
Few things which may help: 1. Use pprof to look at goroutines, see if you have a leak there. 2. What does linux utility lsof say? Don't forget that each network connection uses a "file" so it may not be a real file hand instead a network socket, which given your screen shot could be due to

[go-nuts] Too many open files / broken pipe issue.

2020-05-08 Thread Juhee LR
Hello , I am currently working for a company and one of our site is having little trouble. It is built in golang . I am facing this particular issue for over 3 months now. No matter what solution i've tried so far , it ends up failing. So the site is working fine , but somewhere due to the

Re: [go-nuts] Get name of struct implementing interface using interface method, reflection

2020-05-08 Thread Marcin Romaszewicz
Go isn't polymorphic, whenever your String() function is called, it's on BaseFoo, you have to do it like this: https://play.golang.org/p/69rw0jRPalz On Fri, May 8, 2020 at 1:43 PM Glen Newton wrote: > Thanks! > > Oh no, when I try that here: https://play.golang.org/p/RV-S4MJWYUi > Did not

Re: [go-nuts] Should an assignment from int to a type based on int succeed?

2020-05-08 Thread 'Axel Wagner' via golang-nuts
On Fri, May 8, 2020 at 7:32 PM Brian Candler wrote: > Could you explain why error is not a defined type? Is it something > special about "error" specifically, or something about interface types in > general? > First, the disclaimer again: I'm now coming around that there *is* a reading of a

Re: [go-nuts] Get name of struct implementing interface using interface method, reflection

2020-05-08 Thread Glen Newton
Thanks! Oh no, when I try that here: https://play.golang.org/p/RV-S4MJWYUi Did not work: similar results: instead of: BaseFoo BaseFoo BaseFoo BaseFoo now I get: main.BaseFoo main.BaseFoo main.BaseFoo main.BaseFoo Other suggestions? :-) Thanks, Glen -- You received this message because you

Re: [go-nuts] golang protobuf, struct copy problem

2020-05-08 Thread Robert Engels
Have the compute struct contain the proto struct. > On May 8, 2020, at 1:56 PM, cheng dong wrote: > >  > i use protobuf to do rpc in golang . for every message XXX in proto, i have > to define a struct XXX in go, compute and then copy its field one by one to > pb.XXX(because struct XXX have

Re: [go-nuts] Re: Why is there no instruction rescheduling?

2020-05-08 Thread Ian Lance Taylor
On Fri, May 8, 2020 at 11:56 AM cheng dong wrote: > > i think it is because the go designer want to keep the memory order model of > golang simple That turns out not to be the case. Go's memory model (https://golang.org/ref/mem) permits instruction scheduling. As I mentioned earlier, the

[go-nuts] golang protobuf, struct copy problem

2020-05-08 Thread cheng dong
i use protobuf to do rpc in golang . for every message XXX in proto, i have to define a struct XXX in go, compute and then copy its field one by one to pb.XXX(because struct XXX have some field not in pb.XXX), when i have many struct XXX, it is very ineffective and very slow. so how could i

Re: [go-nuts] Failed to schedule cron job at night

2020-05-08 Thread 'Vikram Ingawale' via golang-nuts
Go version : go version go1.14 windows/amd64 platform : Windows Code : package main import ( "log" "gopkg.in/robfig/cron.v2" "github.com/gin-gonic/gin" ) func main() { g := gin.Default() c := cron.New() c.AddFunc("0 0 * * *", func() { log.Println("Job started at 12:00AM")

[go-nuts] Error while using "github.com/coreos/etcd/clientV3"

2020-05-08 Thread Yashi Gupta
I have been trying to use *"github.com/coreos/etcd/clientv3" for creating a microservice * but while "go build" It shows the following error. *cannot use auth.callOpts (type []"github.com/coreos/etcd/vendor/google.golang.org/grpc".CallOption) as type

[go-nuts] Re: Why is there no instruction rescheduling?

2020-05-08 Thread cheng dong
i think it is because the go designer want to keep the memory order model of golang simple On Wednesday, May 6, 2020 at 11:18:28 AM UTC+8, Richard Gong wrote: > > I've been diving into golang compiler recently. As to the optimizations, I > didn't find any pass implemented instruction

Re: [go-nuts] Failed to schedule cron job at night

2020-05-08 Thread Brian Candler
It looks like there are two different things here. Originally you said: *"my cron expression is 0 15 3 * * * means at midnight 03:15 AM daily"* Midnight has a specific meaning in English (00:00), so I interpreted that as intending to say "overnight at 03:15AM". The second question was about

Re: [go-nuts] Failed to schedule cron job at night

2020-05-08 Thread 'Vikram Ingawale' via golang-nuts
just i was scheduled below job but not logged given msg c.AddFunc("0 0 * * *", func() { log.Println("Job started at 12:00AM") }) above exp means 0 hr 0min means 12AM right .. On Sat, May 9, 2020 at 12:08 AM Brian Candler wrote: > On 08/05/2020 19:35, Vikram Ingawale wrote: > > just i

Re: [go-nuts] Failed to schedule cron job at night

2020-05-08 Thread Brian Candler
The go cron package (that the OP linked to) allows an optional seconds field to be included. -- 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

Re: [go-nuts] Failed to schedule cron job at night

2020-05-08 Thread Kurtis Rader
On Fri, May 8, 2020 at 3:16 AM 'Vikram Ingawale' via golang-nuts < golang-nuts@googlegroups.com> wrote: > I am using the standard cron > package > to schedule cron job at midnight. but my cron job is not started at night > time. > > for day time it

Re: [go-nuts] Should an assignment from int to a type based on int succeed?

2020-05-08 Thread Brian Candler
Plus there is an explicit assignability rule for interface types: * T is an interface type and x implements T. I don't see why any of this implies that error is not a "defined type". -- You received this message because you are subscribed to the

Re: [go-nuts] Should an assignment from int to a type based on int succeed?

2020-05-08 Thread Brian Candler
On Friday, 8 May 2020 16:58:01 UTC+1, Axel Wagner wrote: > > I'm happy to report, that I *think* I found an inconsistency with error > not being a defined type: > Could you explain why error is not a defined type? Is it something special about "error" specifically, or something about interface

Re: [go-nuts] Should an assignment from int to a type based on int succeed?

2020-05-08 Thread 'Axel Wagner' via golang-nuts
sorry, that last sentence of the second paragraph should be "The structural comparison says they *are* identical". On Fri, May 8, 2020 at 6:19 PM Axel Wagner wrote: > Correct. I don't understand why you are saying that, though. > The argument I'm making is that x and y's *types* (not

Re: [go-nuts] Should an assignment from int to a type based on int succeed?

2020-05-08 Thread 'Axel Wagner' via golang-nuts
Correct. I don't understand why you are saying that, though. The argument I'm making is that x and y's *types* (not underlying) types are identical (actually, the argument I *was* making was different, but still had little to do with underlying types). The spec

Re: [go-nuts] Should an assignment from int to a type based on int succeed?

2020-05-08 Thread Christoph Berger
> For clarity, it might make sense to amend the definition-looking section of > the spec with a blurb in the spirit of "defined types are those arising from > a type definition, or the predeclared types yadayadayada" (where yadayadayada  > could be a list, could be the empty string if we resolve

Re: [go-nuts] Should an assignment from int to a type based on int succeed?

2020-05-08 Thread Jan Mercl
On Fri, May 8, 2020 at 5:57 PM Axel Wagner wrote: > > I'm happy to report, that I *think* I found an inconsistency with error not > being a defined type: > https://play.golang.org/p/gpy6S17wzIM I don't follow. Type of x is not a defined type and neither is type of y. The underlying type of x is

Re: [go-nuts] Should an assignment from int to a type based on int succeed?

2020-05-08 Thread Christoph Berger
All agreed, Jan. I have not meant to indicate that the definition of "defined type" is incorrect or complicated. The problem lies in the fact that a type like int, that is commonly recognized as a built-in type, happens to be a "defined type". This, plus the fact that a pointer to int is not a

Re: [go-nuts] Should an assignment from int to a type based on int succeed?

2020-05-08 Thread 'Axel Wagner' via golang-nuts
I'm happy to report, that I *think* I found an inconsistency with error not being a defined type: https://play.golang.org/p/gpy6S17wzIM One of the assignability rules is > x is a bidirectional channel value, T is a channel type, x's type V and T have identical element types, and at least one of V

[go-nuts] package inspection and runtime/proxy implementation of interfaces

2020-05-08 Thread tschinke256 via golang-nuts
I just had the challenge to create proxy implementations of interfaces and I found nothing I could use. So I created a small code generator based on go/parser and go/doc to allow more java-ish reflection stuff with go, including comment processing (annotations with json values):

Re: [go-nuts] Should an assignment from int to a type based on int succeed?

2020-05-08 Thread 'Axel Wagner' via golang-nuts
https://golang.org/ref/spec#Type_definitions > A type definition creates a new, distinct type with the same underlying type and operations as the given type, and binds an identifier to it. […] The new type is called a *defined type*. It is different from any other type, including the type it is

Re: [go-nuts] Should an assignment from int to a type based on int succeed?

2020-05-08 Thread Jan Mercl
On Fri, May 8, 2020 at 4:31 PM Christoph Berger wrote: > Unfortunately, the connection between "predeclared" (or "implicitly declared" > as the first paragraph says) and "defined" is not at all obvious. Especially > as the definition of "defined type" refers to types explicitly declared via >

Re: [go-nuts] Should an assignment from int to a type based on int succeed?

2020-05-08 Thread Christoph Berger
Thank you Jan, this helped me a lot. Unfortunately, the connection between "predeclared" (or "implicitly declared" as the first paragraph says) and "defined" is not at all obvious. Especially as the definition of "defined type" refers to types explicitly declared via the "type" keyword. I

Re: [go-nuts] Should an assignment from int to a type based on int succeed?

2020-05-08 Thread Jan Mercl
On Fri, May 8, 2020 at 3:29 PM Christoph Berger wrote: > So I conclude that the assignment of *int to intp succeeds because *int is > not a defined type and both *int and intp have the same underlying type *int. > > Looking through the ref spec I found a couple of places that mention some >

Re: [go-nuts] Should an assignment from int to a type based on int succeed?

2020-05-08 Thread Christoph Berger
Thanks for the quick reply Jan. So I conclude that the assignment of *int to intp succeeds because *int is not a defined type and both *int and intp have the same underlying type *int. Looking through the ref spec I found a couple of places that mention some defined types (esp., all numeric

Re: [go-nuts] Should an assignment from int to a type based on int succeed?

2020-05-08 Thread Jan Mercl
On Fri, May 8, 2020 at 2:46 PM wrote: > Or do I just fail to see the obvious... 'int' _is_ a defined type. It's predeclared in the universe scope. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] Should an assignment from int to a type based on int succeed?

2020-05-08 Thread christophberger . com
Hi folks, I am not sure but to me it seems that the third assignment in the below code adheres to assignability rule #2 from the spec, yet it fails to compile: package main import "fmt" /* Assignability rule #2

Re: [go-nuts] Module versioning on local folder

2020-05-08 Thread Shulhan
> On 8 May 2020, at 14.26, Reyhan Sofian Haqqi wrote: > > The question is why you can't have any version inside the shared libs? How do > you shared the libs locally? > > Because we use monorepo. Maybe git tag works since it's also pointing to a > commit hash? but does it works if we use

[go-nuts] Failed to schedule cron job at night

2020-05-08 Thread 'Vikram Ingawale' via golang-nuts
Hello Gophers , I am using the standard cron package to schedule cron job at midnight. but my cron job is not started at night time. for day time it works properly . my cron expression is 0 15 3 * * * means at midnight 03:15 AM daily -- You

[go-nuts] Re: Type Assertion on File type

2020-05-08 Thread Brian Candler
Perhaps a bit clearer: https://play.golang.org/p/WyzuLMuyelh -- 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

[go-nuts] Re: Type Assertion on File type

2020-05-08 Thread Brian Candler
When you write: f, err := os.OpenFile(filename, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) the types of 'f' and 'err' are defined statically and magically as whatever the declared return types of os.OpenFile are. It's like you wrote: var f type1 var err type2 f, err =

Re: [go-nuts] Module versioning on local folder

2020-05-08 Thread Reyhan Sofian Haqqi
> > The question is why you can't have any version inside the shared libs? How > do you shared the libs locally? Because we use monorepo. Maybe git tag works since it's also pointing to a commit hash? but does it works if we use `replace` directive on go.mod file? If the replace directive

[go-nuts] Re: Type Assertion on File type

2020-05-08 Thread Amnon Baron Cohen
The beautiful thing about Go is that it is statically typed, so you don't need to check if your function returned an *os.File. The compiler already did it for you On Thursday, 7 May 2020 17:57:05 UTC+1, André kouamé wrote: > > Hi, > > I want to check, if the value return by my function has