Re: [go-nuts] Re: Ioctl Syscall with go and c

2018-08-23 Thread Tamás Gulácsi
2018. augusztus 23., csütörtök 21:50:54 UTC+2 időpontban sbez...@cisco.com a következőt írta: > > I copied the whole thing to https://github.com/sbezverk/vfio > > Running it without actual vfio/iommu might be problematic though. > > Before this specific ioctl can be run 2 open calls must succe

[go-nuts] Connecting to a nondefault database with denisenkom

2018-08-23 Thread Femi
This is potentially a noob question but I thought I would ask anyway. I am trying to connect to a nondefault database using denisenkom/go-mssqldb. I am able to connect to master using the code below but swapping the master database to a database that I created fails. I figured that I can do som

Re: [go-nuts] Does runtime.RaceDisable not work in non-std library ?

2018-08-23 Thread Dave Cheney
Hi, Can you please do two things to help with this error report. 1. Please include the entire data race report -- we need this to match up the line with the source code you've provided in the gist 2. Please double check that you are not copying a your sync.Pool type by value, this can happen if

Re: [go-nuts] Does runtime.RaceDisable not work in non-std library ?

2018-08-23 Thread nealhoo
Hi lan, The sync.Pool has memory accesses in per-p private storage. Why it not reports `DATA RACE`, but it reports when I copy those code outside stdlib? I'm confused about this, or there is something wrong in https://gist.github.com/lrita/efa8c4ae555b4b7cceee29b4ed819652 Thanks. 在 2018年8月24日星

Re: [go-nuts] Re: function's argument default value

2018-08-23 Thread Louki Sumirniy
I don't think the benefits are obvious and being able to leave out parameters by specifying one by name is of dubious benefit. Could you not simply write a short set of if statements that insert a default by using a nulled sentinel. Like this: func PrintMessage(s string) { if s == "" { s

Re: [go-nuts] Re: function's argument default value

2018-08-23 Thread Louki Sumirniy
I have to agree. The idiomatic solution would be defining multiple functions that wrap around another, and it is not onerously boilerplatey. As Ian says, default values do constitute effectively function overloads. There is reason why function overloading is not available in Go. Just go look a

Re: [go-nuts] Re: function's argument default value

2018-08-23 Thread andrey mirtchovski
> You're right but I think developers of Go can think about that because its > benefits are obvious. can you please enumerate those benefits? many gophers are not convinced they are obvious. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To un

Re: [go-nuts] Re: function's argument default value

2018-08-23 Thread Masoud Ghorbani
You're right but I think developers of Go can think about that because its benefits are obvious. On Friday, August 24, 2018 at 1:23:32 AM UTC+4:30, Axel Wagner wrote: > > On Thu, Aug 23, 2018 at 9:44 AM Masoud Ghorbani > wrote: > >> Your opinion is like to say all of the python application shoul

Re: [go-nuts] Re: function's argument default value

2018-08-23 Thread Ian Lance Taylor
On Thu, Aug 23, 2018 at 4:20 PM, Masoud Ghorbani wrote: > I didn't get the relation of function overloading with parameters default > value. actually, function overloading means define functions with similar > names. Right. After adding a default value for the parameter, you have two functions w

Re: [go-nuts] Re: function's argument default value

2018-08-23 Thread Masoud Ghorbani
I didn't get the relation of function overloading with parameters default value. actually, *function overloading* means define functions with similar names. On Friday, August 24, 2018 at 1:11:12 AM UTC+4:30, Ian Lance Tay

Re: [go-nuts] internal compilation error while compiling gccgo from source solaris 10

2018-08-23 Thread Amandeep Gautam
Running inside the gdb worked. Seems like a problem with libmpfr. Will try compiling it from source. Following is the end of the GDB output: /export/home/amandeep/gccgo-src/libgo/go/fmt/scan.go:658:43: error: expected integer, floating, complex, or string type s.errorString("integer overflow

Re: [go-nuts] internal compilation error while compiling gccgo from source solaris 10

2018-08-23 Thread Ian Lance Taylor
On Thu, Aug 23, 2018 at 2:14 PM, Amandeep Gautam wrote: > > /export/home/amandeep/gccgo-obj/./gcc/go1 > /export/home/amandeep/gccgo-src/libgo/go/fmt/doc.go > /export/home/amandeep/gccgo-src/libgo/go/fmt/format.go > /export/home/amandeep/gccgo-src/libgo/go/fmt/print.go > /export/home/amandeep/gccgo

Re: [go-nuts] internal compilation error while compiling gccgo from source solaris 10

2018-08-23 Thread Amandeep Gautam
Thanks. I did do that befor but thought you meant different. I ran the following: /export/home/amandeep/gccgo-obj/./gcc/gccgo -B/export/home/amandeep/gccgo-obj/./gcc/ -B/usr/gnu/sparc-sun-solaris2.10/bin/ -B/usr/gnu/sparc-sun-solaris2.10/lib/ -isystem /usr/gnu/sparc-sun-solaris2.10/include -is

Re: [go-nuts] Re: function's argument default value

2018-08-23 Thread 'Axel Wagner' via golang-nuts
On Thu, Aug 23, 2018 at 9:44 AM Masoud Ghorbani wrote: > Your opinion is like to say all of the python application should rethink > and re-write their structure because they used default values. > One general thing to observe in all these discussions is, that Go is not Python (or Rust, Haskell,

Re: [go-nuts] Re: function's argument default value

2018-08-23 Thread Ian Lance Taylor
On Thu, Aug 23, 2018 at 12:44 AM, Masoud Ghorbani wrote: > > Your opinion is like to say all of the python application should rethink and > re-write their structure because they used default values. I think having > default values for parameters is just a feature which will make codebase > readabl

Re: [go-nuts] internal compilation error while compiling gccgo from source solaris 10

2018-08-23 Thread Ian Lance Taylor
On Thu, Aug 23, 2018 at 1:24 AM, Amandeep Gautam wrote: > Hi Ian, > I ran the following after changing directory to > /export/home/amandeep/gccgo-obj/sparc-sun-solaris2.10/libgo/: > > files=`echo /export/home/amandeep/gccgo-src/libgo/go/fmt/doc.go > /export/home/amandeep/gccgo-src/libgo/go/fmt/f

Re: [go-nuts] Does runtime.RaceDisable not work in non-std library ?

2018-08-23 Thread Ian Lance Taylor
On Thu, Aug 23, 2018 at 12:43 AM, wrote: > package main > > import "runtime" > > var a int > > func calc() { > for i := 0; i < 10; i++ { > go func() { > for { > runtime.RaceDisable() > a++ > runtime.RaceEnable() >

Re: [go-nuts] Re: Ioctl Syscall with go and c

2018-08-23 Thread 'Serguei Bezverkhi (sbezverk)' via golang-nuts
I copied the whole thing to https://github.com/sbezverk/vfio Running it without actual vfio/iommu might be problematic though. Before this specific ioctl can be run 2 open calls must succeed. See func main. Thank you for looking into this problem Serguei Sent from my iPhone > On Aug 23, 2018,

Re: [go-nuts] Old fashioned Unix password crypt

2018-08-23 Thread Michael Jones
https://minnie.tuhs.org//cgi-bin/utree.pl?file=V6/usr/source/s1/crypt.c On Thu, Aug 23, 2018 at 10:32 AM Lucio wrote: > Am I missing something altogether too trivial, or is the modified DES > encryption used in the old fashioned Unix /etc/passwd file just not > implemented in Go at all, not eve

[go-nuts] Re: Local cache of dependencies

2018-08-23 Thread wilk
On 22-08-2018, Conor Hackett wrote: > --=_Part_816_169128197.1534976743243 > Content-Type: multipart/alternative; > boundary="=_Part_817_1168505210.1534976743243" > > --=_Part_817_1168505210.1534976743243 > Content-Type: text/plain; charset="UTF-8" > > Hey Guys, > > So, adding yo

[go-nuts] Old fashioned Unix password crypt

2018-08-23 Thread Lucio
Am I missing something altogether too trivial, or is the modified DES encryption used in the old fashioned Unix /etc/passwd file just not implemented in Go at all, not even as a reasonably easily found user package? Even though crypt(3) is no doubt dated, there may be value in some Go support

[go-nuts] Re: Stream directory content on the fly over HTTP using TAR archive

2018-08-23 Thread Tamás Gulácsi
2018. augusztus 23., csütörtök 18:39:01 UTC+2 időpontban Remi Ferrand a következőt írta: > > Hi everyone, > > This is my first message on this list so please apologize if this > discussion has already showed up in the past. > > What I'm trying to do is quite simple. > > I do have a directory wit

Re: [go-nuts] Re: Ioctl Syscall with go and c

2018-08-23 Thread Tamás Gulácsi
Cany you give a complete example? https://play.golang.org/p/ZQSf-PwMtd9 says "device=18446744073709551615 errno=inappropriate ioctl for device" -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receivi

[go-nuts] Data Access Object generator for Postgres using pgx

2018-08-23 Thread umakanthdiwakar
As part of our product enhancements, we develop microservices using GO and Postgres. pgx was the driver of choice, given its superior performance w.r.t pq. However, the procedural nature of coding in pgx or pq was a stumbling block for developer productivity. Hence we designed a typical single

[go-nuts] Re: Local cache of dependencies

2018-08-23 Thread James Warren
Hey Conor, Athens is a new project in its early stages which deals with this problem space, its closely linked to the new modules features coming in go1.11. It's still in very early stages but looks very interesting - definitely one to keep an eye on. Cheers,

[go-nuts] Local cache of dependencies

2018-08-23 Thread Antonio Troina
Hi Conor 👋 Have you looked at Project Athens already? Here’s the link, you can easily find the GitHub repo and see what it’s all about: https://docs.gomods.io/ I know you can run it locally or on a server in the cloud, so it sounds something similar to what you have just described. -- You re

[go-nuts] Stream directory content on the fly over HTTP using TAR archive

2018-08-23 Thread Remi Ferrand
Hi everyone, This is my first message on this list so please apologize if this discussion has already showed up in the past. What I'm trying to do is quite simple. I do have a directory with files I want to share to a friend from my workstation. I would like him to: 1. point his web browser to

Re: [go-nuts] Re: Ioctl Syscall with go and c

2018-08-23 Thread 'Serguei Bezverkhi (sbezverk)' via golang-nuts
Hello Jake, Apologies about formatting, here is correctly formatted code: // GetGroupFD gets File descriptor for a specified by PCI address device func GetGroupFD(group int, pciDevice string) (int, error) { buffer := make([]byte, len(pciDevice)+1) for i, c := range

[go-nuts] Re: Local cache of dependencies

2018-08-23 Thread David Skinner
Modules rarely disappear but when they do it can have a profound impact on a project. I am really paranoid so I sometimes fork a project to a private repo just to have it on hand just in case. I have used git submodules from the git command line as a solution. I still do, but I would not recomme

Re: [go-nuts] Re: Ioctl Syscall with go and c

2018-08-23 Thread jake6502
First off, I don't know how you are posting your code samples, but they are unreadable in my Firefox and Chrome on windows. Second, I would point out that the system you use for converting a "string" to the buffer will fail if there are any non-ascii characters. Third, OT, but I wonder why pc

[go-nuts] [ANN] kitty, a lightweight microservice framework extending go-kit

2018-08-23 Thread Jean-François Bustarret
We just open-sourced kitty, a microservice framework extending go-kit - https://github.com/objenious/kitty Kitty's goal is to ease development of microservices deployed on Kubernetes (or any similar orchestration platform). Kitty has an opinion on: - transports: only HTTP is supported (additio

Re: [go-nuts] Re: Ioctl Syscall with go and c

2018-08-23 Thread 'Serguei Bezverkhi (sbezverk)' via golang-nuts
Hi Max, Thanks for the suggestion, unfortunately it did not help, see below: func GetGroupFD(group int, pciDevice *string) (int, error) { fmt.Printf("VFIO_GROUP_GET_DEVICE_FD() returned: %04x\n", VFIO_GROUP_GET_DEVICE_FD()) buffer := make([]byte, len(*pciDevice)+1) for i, c := range

Re: [go-nuts] Re: Ioctl Syscall with go and c

2018-08-23 Thread Max
Hi Serguei, a Go string or *string do not correspond to a C char * You must pass the address of the first byte of a sufficiently large buffer: func GetGroupFD(group int, pciDevice *string) (int, error) { const N = 256 var buffer [N]byte device, _, errno := syscall.Syscall( syscall.S

Re: [go-nuts] Local cache of dependencies

2018-08-23 Thread Jim Ancona
I believe Athens (https://github.com/gomods/athens) is meant to address this use case in the Go modules world. Jim On Wed, Aug 22, 2018 at 7:51 PM Conor Hackett wrote: > Thanks Sam, > > I'll have a look out of curiosity but I am very reluctant to > introduce/recommend Git submodules to any of m

Re: [go-nuts] Re: Ioctl Syscall with go and c

2018-08-23 Thread 'Serguei Bezverkhi (sbezverk)' via golang-nuts
I changed code a little bit to be able to examine variables: func GetGroupFD(group int, pciDevice *string) (int, error) { ioctlId := 0x3b6a var buffer uintptr buffer = uintptr(unsafe.Pointer(pciDevice)) device, _, errno := syscall.Syscall( syscall.SYS_IOCTL, uintpt

[go-nuts] Re: Ioctl Syscall with go and c

2018-08-23 Thread Tamás Gulácsi
Is it \0-terminated? 2018. augusztus 23., csütörtök 13:02:13 UTC+2 időpontban sbez...@cisco.com a következőt írta: > > Hello, > > I am converting some C code to Go and hit an issue with one particular > Syscall: > > In C: > > device = ioctl(group, 0x3b6a, path); > where path is char[

[go-nuts] Ioctl Syscall with go and c

2018-08-23 Thread 'Serguei Bezverkhi (sbezverk)' via golang-nuts
Hello, I am converting some C code to Go and hit an issue with one particular Syscall: In C: device = ioctl(group, 0x3b6a, path); where path is char[N] In Go: ioctlId := 0x3b6a device, _, errno := syscall.Syscall( syscall.SYS_IOCTL, uintptr(group),

[go-nuts] Re: function's argument default value

2018-08-23 Thread Louki Sumirniy
Actually, going a little further, I would like to see a change in Golang where parameter and return tuples can be set the same way as structs - so if you use named labels ( label="value ) it assumes null for any others specified. Then you can add one more feature, which is also related and give

[go-nuts] Re: function's argument default value

2018-08-23 Thread Louki Sumirniy
Actually, my real opinion is that I like these default argument values, I also like concise asserts at the head of functions that automatically sanitise data. But they cost quite a lot which is likely why Go doesn't have them. Default arguments are the least useful of the two, asserts have a mu

Re: [go-nuts] internal compilation error while compiling gccgo from source solaris 10

2018-08-23 Thread Amandeep Gautam
Hi Ian, I ran the following after changing directory to /export/home/amandeep/gccgo-obj/sparc-sun-solaris2.10/libgo/: files=`echo /export/home/amandeep/gccgo-src/libgo/go/fmt/doc.go /export/home/amandeep/gccgo-src/libgo/go/fmt/format.go /export/home/amandeep/gccgo-src/libgo/go/fmt/print.go /

[go-nuts] Re: function's argument default value

2018-08-23 Thread Masoud Ghorbani
Your opinion is like to say all of the python application should rethink and re-write their structure because they used default values. I think having default values for parameters is just a feature which will make codebase readable and smaller than before. On Thursday, August 23, 2018 at 4:38:

Re: [go-nuts] Does runtime.RaceDisable not work in non-std library ?

2018-08-23 Thread buaa . cch
package main import "runtime" var a int func calc() { for i := 0; i < 10; i++ { go func() { for { runtime.RaceDisable() a++ runtime.RaceEnable() } }() } } func main() { calc() } go run -race a.go

Re: [go-nuts] Re: What is the behavior of an HTTP persistent connection in Go?

2018-08-23 Thread golangnutter
Thanks this really is a great explanation. So new connections will be created if there are no idle connection available. The following article suggests setting the Transport.MaxIdleConnsPerHost to the same value as Transport.MaxIdleConns to allow any host to use all connections if necessary. ht