[go-nuts] Re: Calling Go from Python

2021-04-06 Thread Justin Israel
On Wednesday, April 7, 2021 at 6:10:49 AM UTC+12 amitl...@gmail.com wrote: > > Hi, > A cheat-sheet I wrote for myself evolved into a full tutorial > on calling Go directly from Python > using ctypes and dll's, so I am happy to share it with the community. It

[go-nuts] Re: Some pthread_ function can't be found in by gollvm

2021-04-06 Thread JX Zhang
Has anyone ever encountered this problem? 在2021年4月6日星期二 UTC+8 下午9:20:48 写道: > ✘~/workspace/gowork/src/pthread $ go build . > # pthread > ccode.c:12:15: warning: incompatible integer to pointer conversion passing > 'pthread_t' (aka 'unsigned long') to parameter of type 'pthread_once_t *' > (aka

[go-nuts] Re: Calling Go from Python

2021-04-06 Thread jin jiao
Hi Guys, I want to build a Terraform provider for our platform, so we can automate our platform tasks and API calls directly from Terraform. So both Golang and Terraform experience will be desired.More info about Terraform providers can be found here: https://learn.hashicorp.com/tutorials/terraf

[go-nuts] package is not in GOROOT

2021-04-06 Thread rob
> This example is on Win10 using go 1.16.3 Now I've created a directory tree outside of ~/go/src.  I'm using ~ to mean %userprofile%, as this is win10 ~/gcode/rpng/rpng.go ~/gcode/tokenize/tokenize.go ~/gcode/hpcalc2/hpcalc2.go And I updated my import statement to be "gcode/hpcalc2", etc.

[go-nuts] Calling Go from Python

2021-04-06 Thread Amit Lavon
Hi, A cheat-sheet I wrote for myself evolved into a full tutorial on calling Go directly from Python using ctypes and dll's, so I am happy to share it with the community. It starts from the very basics and covers how to handle arrays, strings and objects in

[go-nuts] Re: HTTP routes in different Packages

2021-04-06 Thread David Fornazier
Hello! You could create in your packages a function that receives a *http.ServeMux, by this reference you can configure you're path an function related. Example: "example.go" func FooPath(mux *http.ServeMux) { mux.HandleFunc("/foo", exampleFoo) } func exampleFoo(w http.Res..., r *http.R

[go-nuts] Re: HTTP routes in different Packages

2021-04-06 Thread Van Fury
"I have two other packages, example.go and user.go" - I mean these files example.go and user.go are in different directories not the same package, and have the package names "package example" and "package user". The main.go is also in different directory with "package main". On Tuesday, April

[go-nuts] Re: HTTP routes in different Packages

2021-04-06 Thread Abraham Afriyie
"I have two other packages, example.go and user.go" - I mean these files example.go and user.go are in different directories not the same package, and have the package names "package example" and "package user". The main.go is also in different directory with "package main". On Tuesday, April

[go-nuts] Re: HTTP routes in different Packages

2021-04-06 Thread Brian Candler
These may be helpful: https://golang.org/doc/code#Organization https://golang.org/doc/faq#How_do_I_create_a_multifile_package -- 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 a

[go-nuts] Re: HTTP routes in different Packages

2021-04-06 Thread Brian Candler
It's unclear when you say "I have two other packages, example.go and user.go which contain the handler functions." If these files are all in the same directory, then they are all be part of the *same* package. For example, they'll all have "package main" as the first line. Since you don't sho

[go-nuts] HTTP routes in different Packages

2021-04-06 Thread Van Fury
HI, I have the following settings in my REST API program packages: In "routers.go" type Route struct { Namestring Method string Pattern string HandlerFunc http.HandlerFunc } var Router = NewRouter() type Routes []Route func NewRouter() *mux.Router { route

Re: [go-nuts] Re: Update to generics proposal

2021-04-06 Thread yiyus
I was specifically talking about Ian's example, where no methods are defined. On Tuesday, 6 April 2021 at 15:57:18 UTC+2 Thomas Bushnell, BSG wrote: > On Mon, Apr 5, 2021 at 9:04 PM yiyus wrote: > >> > then I guess you mean that interface { MyInt } will accept any type >> > argument whose unde

Re: [go-nuts] Re: Update to generics proposal

2021-04-06 Thread 'Thomas Bushnell BSG' via golang-nuts
On Mon, Apr 5, 2021 at 9:04 PM yiyus wrote: > > then I guess you mean that interface { MyInt } will accept any type > > argument whose underlying type is the same as the underlying type of > > MyInt. But that seems strange. There is no connection between MyInt > > and MyInt2, except that they ha

Re: [go-nuts] Re: Where is the display profile from x/net/idna defined

2021-04-06 Thread Sam Whited
Yes sorry, I mean "where is it documented". The other profiles all list the RFC from which the rules are taken, but this one does not. —Sam On Mon, Apr 5, 2021, at 11:58, jake...@gmail.com wrote: > I'm guessing you want to know where the behavior is documented? That I > do not know. -- You rece

Re: [go-nuts] Should reads from a net.Conn be made to respect a context deadline

2021-04-06 Thread Sam Whited
Thanks Ian, On Sun, Apr 4, 2021, at 19:42, Ian Lance Taylor wrote: > Speaking more broadly, while a context is often a deadline, it can > also be cancelled for other reasons (via ctx.WithCancel). Those other > reasons can include things like "we no longer need this data." So > that is an argumen

[go-nuts] Re: Some pthread_ function can't be found in by gollvm

2021-04-06 Thread JX Zhang
✘~/workspace/gowork/src/pthread $ go build . # pthread ccode.c:12:15: warning: incompatible integer to pointer conversion passing 'pthread_t' (aka 'unsigned long') to parameter of type 'pthread_once_t *' (aka 'int *') [-Wint-conversion] /usr/include/pthread.h:495:42: note: passing argument to p

[go-nuts] Re: go mod vendor, description, how?

2021-04-06 Thread Manlio Perillo
Il giorno martedì 6 aprile 2021 alle 09:47:18 UTC+2 Gergely Födémesi ha scritto: > Hi, > > assuming GO111MODULE=on. > I don't want to publish anything, anywhere. > > If you don't want to publish anything, you can use a reserved domain in your module path; as an example: gergely.localhost, or

[go-nuts] Some pthread_ function can't be found in by gollvm

2021-04-06 Thread JX Zhang
I met some problem about pthread. I wrote a cgo demo which use some pthread_* function, but it compile failed ccode.c ``` # include # include "ccode.h" # include int try_pthread(){ pthread_t id; int ret, i = 0; ret = pthread_create(&id,NULL,(void *)thread,NULL); for(i=0;i<=5;i++) printf("This

[go-nuts] GopherJS 1.16 released!

2021-04-06 Thread Jonathan Hall
After lagging behind Go for about 2 years (since version 1.12), GopherJS 1.16.0+go1.16.3 has been released with Go 1.16 support! GopherJS compiles Go code to pure JavaScript code (not WebAssembly). It’s main purpose is to

[go-nuts] Re: these code line seens never reachable, can it be deleted?

2021-04-06 Thread peterGo
Why did you ignore other similar occurences? :~/go/src/cmd/internal/obj$ grep -r 'if false {' * arm/asm5.go:if false { /*debug['O']*/ arm/asm5.go:if false { /*debug['P']*/ arm/asm5.go:if false { /*debug['G']*/ arm64/asm7.go:if false { arm64/asm7.go:if false { /*debug['P']*/

[go-nuts] these code line seens never reachable, can it be deleted?

2021-04-06 Thread xie cui
https://github.com/golang/go/blob/master/src/cmd/internal/obj/x86/asm6.go#L2192-L2210 if it can be delete i will send a pr! -- 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

[go-nuts] Re: package is not in GOROOT

2021-04-06 Thread 'Carla Pfaff' via golang-nuts
On Tuesday, 6 April 2021 at 02:13:14 UTC+2 rob wrote: > I'm still struggling w/ modules to get my code to compile. This example > is on Win10 using go 1.16.3 > > ~/go/src/rpng/rpng.go > ~/go/src/tokenize/tokenize.go > ~/go/src/hpcalc2/hpcalc2.go > > Put them in a directory, e.g. "rob". This

[go-nuts] Re: go mod vendor, description, how?

2021-04-06 Thread Brian Candler
You don't need to vendor anything unless you're importing third-party code from other repositories, AND you don't want them to be fetched dynamically. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiv

[go-nuts] Re: go mod vendor, description, how?

2021-04-06 Thread Volker Dobler
Probably you are overthinking it. Start like this go mod init me.nil/project It doesn't matter whether you want to publish your project or not you must start with a module and a proper name including a dot and a slash doesn't harm and avoids several problems. Of course you also could name it

[go-nuts] Re: go mod vendor, description, how?

2021-04-06 Thread Brian Candler
It depends what you're trying to achieve. In the simplest case, is this all one project in one repo, but broken into packages? In that case, you can just "go mod init" in the top-level directory, and then you create your dependent packages in subdirectories (without go.mod files). Here I just

[go-nuts] go mod vendor, description, how?

2021-04-06 Thread fgergo
Hi, assuming GO111MODULE=on. I don't want to publish anything, anywhere. Beside the main package, I want to put functionality into other new packages as well. Could somebody share the workflow to do _only_ that? Where can I read about the correct incantations? To organize the source files on ht