Re: [go-nuts] Install vim-go as a pacakge in vim 8

2016-09-19 Thread Jan Mercl
On Sun, Sep 18, 2016 at 10:46 AM Johann Höchtl wrote: > I thought Vim 8 packages are all automatic. vim-go commands like :help vim-go or :GoUpdateBinaries do not work. Are you using the vim-8.0 branch? ( https://github.com/fatih/vim-go/tree/vim-8.0) -- -j -- You

Re: [go-nuts] file or folder encryption tool

2016-09-19 Thread Nick Craig-Wood
On 19/09/16 10:49, DrGo wrote: > Has any used Go to develop a cross-platform an easy-to-use utility to encrypt > individual files or folders? > You could use rclone to encrypt a directory of files. It can also transfer them to cloud storage systems too! See rclone.org for docs and

[go-nuts] write in file the result of code

2016-09-19 Thread Nosferatu fist
Hello I have a desire to write in the result of the code file: package main import ( "fmt" "math/big" "github.com/btcsuite/btcd/btcec" "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcutil" "github.com/btcsuite/btcutil/base58" ) func main() { // Print

Re: [go-nuts] [ANN] go-scp: a scp client library in go

2016-09-19 Thread 'Paul Borman' via golang-nuts
Adding an scp package is a nice addition. You might want to consider simple names like: Send - Sends from []byte to file on remote host SendDir - Send files in dir to a remote host SendFile - Sends the contents of a file to the remote host Fetch - Fetches the contents of a file on remote host

Re: [go-nuts] file or folder encryption tool

2016-09-19 Thread DrGo
Thanks Nick, This looks promising! -- 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. For more options, visit

[go-nuts] Re: Install vim-go as a pacakge in vim 8

2016-09-19 Thread Sean Russell
On Monday, September 19, 2016 at 5:13:21 AM UTC-4, Tamás Gulácsi wrote: > > Nope, I'm on neovim (with plug for the plugins) for a long time now... I don't think I even needed a plug for the plugins -- I just cp -r ~/.vim ~/.config/nvim and everything worked, including vim-go. --- SER -- You

[go-nuts] How to implement this In golang

2016-09-19 Thread kumargv
cursor = conn.cursor(MySQLdb.cursors.DictCursor) cursor.execute('SHOW SLAVE STATUS') result = cursor.fetchone() cursor.close() I am unable to Impement this in golang Please suggest -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Re: Alignment and Padding / Packing of structs

2016-09-19 Thread Ali Demir
Header file won't have padding / alignment info. That would be a compiler setting on the C side that is using the header. So the programmer needs to setup C compiler in a way that is compatible with the go compiler. How would he know how to set it up? Do we just assume defaults are the same

[go-nuts] fatal error:malloc deadlock

2016-09-19 Thread Wanghb Wang
when I use stattcpupprof in my program, I got fatal error malloc deadlock. delete the cpu pprof, the program run well. my question is : Does startcpuprof infect the malloc or resulting OOM Problem this is my panic stack trace: fatal error: malloc deadlock goroutine 17 [running, locked to

[go-nuts] How to implement In Golang

2016-09-19 Thread kumargv
import MySQLdb conn = MySQLdb.Connect( host='localhost', user='user', passwd='secret', db='test') cursor = conn.cursor() cursor.execute("SELECT this,that FROM foobar") rows = cursor.fetchall() cursor.close() conn.close() I am unable to Implement The above code in golang Please suggest

[go-nuts] How to impelment this Golang

2016-09-19 Thread kumargv
import MySQLdb import MySQLdb.cursors conn = MySQLdb.Connect( host='localhost', user='user', passwd='secret', db='test') cursor = conn.cursor(cursorclass=MySQLdb.cursors.DictCursor) cursor.execute("SELECT this,that FROM foobar") rows = cursor.fetchall() for row in rows: print

[go-nuts] Re: fatal error:malloc deadlock

2016-09-19 Thread Wanghb Wang
> > my dll is compile by visual studio 2015 on windows10 > If you think this is safe , you can rename the attachment test001DLL as test0001.dll, or you can find code from -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from

[go-nuts] Re: Calling a Go function from asm ("fatal error: missing stackmap")

2016-09-19 Thread Peng Gao
BTW in your test file, you can directly append your bytes slice. b1 = append(b1, vs...) and slicesEqual is redundant, bytes.Equal does test the length of two arguments. On Tuesday, September 20, 2016 at 6:56:55 AM UTC+8, Caleb Spare wrote: > > I'm trying to call a Go function from asm and I'm

Re: [go-nuts] fatal error:malloc deadlock

2016-09-19 Thread Ian Lance Taylor
On Mon, Sep 19, 2016 at 6:34 PM, Wanghb Wang wrote: > > > 在 2016年9月20日星期二 UTC+8上午3:41:09,Ian Lance Taylor写道: >> >> On Mon, Sep 19, 2016 at 8:34 AM, Wanghb Wang wrote: >> > >> > when I use stattcpupprof in my program, I got fatal error malloc >> > deadlock.

[go-nuts] Re: Calling a Go function from asm ("fatal error: missing stackmap")

2016-09-19 Thread Peng Gao
On Tuesday, September 20, 2016 at 11:00:34 AM UTC+8, Peng Gao wrote: > > BTW in your test file, you can directly append your bytes slice. > b1 = append(b1, vs...) > and slicesEqual is redundant, bytes.Equal does test the length of two > arguments > I mix up cap and len, just ignore it. > > On

Re: [go-nuts] fatal error:malloc deadlock

2016-09-19 Thread Wanghb Wang
new issue address is https://github.com/golang/go/issues/17165 在 2016年9月20日星期二 UTC+8下午12:04:09,Ian Lance Taylor写道: > > On Mon, Sep 19, 2016 at 6:34 PM, Wanghb Wang > wrote: > > > > > > 在 2016年9月20日星期二 UTC+8上午3:41:09,Ian Lance Taylor写道: > >> > >> On Mon, Sep 19, 2016 at

Re: [go-nuts] differences between pointer and value slice in for-range loop

2016-09-19 Thread Marvin Renich
* Fei Ding [160918 02:58]: > Thanks, Marvin, I've learned a lot from your reply. And, I've written more > code, like: > > a, b, c := 1, 2, 3 > > slice1 := []int{a, b, c} > > for _, n := range slice1 { > > go func(n *int) {fmt.Println(*n)}() > > } > > > It seems that pass

Re: [go-nuts] Re: Alignment and Padding / Packing of structs

2016-09-19 Thread demir9
Is there any update to alignment/padding for structs now that we can write .so files that can be called by C programs? We would have to know it to tell the C compiler what to expect from go side imho. On Thursday, April 5, 2012 at 9:10:48 PM UTC-7, Kyle Lemons wrote: > > On Thu, Apr 5, 2012

[go-nuts] Ivy crashes on iOS 10

2016-09-19 Thread matthias
- Downloaded Ivy 1.0 from the Apple AppStore - Tried to open it but immediately crashes Anybody with same experiences? -- 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] net/http: In the infinite loop, refused all requests.

2016-09-19 Thread Tony Chen
What version of Go are you using (go version)? go 1.6.2 mac/amd64 What operating system and processor architecture are you using (go env)? GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/data/apps/go" GORACE="" GOROOT="/usr/local/go"

Re: [go-nuts] Ivy crashes on iOS 10

2016-09-19 Thread Jan Mercl
On Mon, Sep 19, 2016 at 3:58 PM wrote: > Anybody with same experiences? https://github.com/robpike/ivy/issues/29 -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

Re: [go-nuts] Re: Alignment and Padding / Packing of structs

2016-09-19 Thread Ian Lance Taylor
On Sun, Sep 18, 2016 at 11:10 PM, wrote: > Is there any update to alignment/padding for structs now that we can write > .so files that can be called by C programs? We would have to know it to tell > the C compiler what to expect from go side imho. When you use //export with

[go-nuts] Re: net/http: In the infinite loop, refused all requests.

2016-09-19 Thread James Bardin
A busy loop is always a programming error, and there's no reason to do this is your code. If you actually did have a loop with no function calls that's somehow useful, you could add occasional calls to runtime.Gosched() to yield to the scheduler. -- You received this message because you

Re: [go-nuts] SQL database connection

2016-09-19 Thread lochbm
I fixed that but I still get errors connecting to the SQL database. Should I deactivate XAMPP before trying it out? On Monday, September 19, 2016 at 12:35:30 PM UTC+3, Harald Weidner wrote: > > Hello, > > On Mon, Sep 19, 2016 at 01:37:14AM -0700, loc...@gmail.com > wrote: > > > import( > >

[go-nuts] Escape special shell characters when using os.Getenv

2016-09-19 Thread weiteng . huang
I tried to `escape` dollar sign when using os.Getenv; I found that golang doesn’t do exactly what I expect (for example `$$var_one` —> print `$var_one`). Any suggestion? https://play.golang.org/p/8fXS4QfCIi , my temporary solution requires copying code from golang os pkg

[go-nuts] glog incorrectly checks CommandLine.Parsed()

2016-09-19 Thread Eric Paris
Some projects (such as kubernetes and docker) do not use the standard 'flag' package and instead use the posix complaint(ish) https://github.com/spf13/pflag package. It however appears that https://github.com/golang/glog/pull/13 Added a check for `flag.Parsed()`. This is not correct for

[go-nuts] collect2.exe: error: ld returned 1 exit status

2016-09-19 Thread yourhso
What version of Go are you using (go version)? go version go1.7 windows/amd64 What operating system and processor architecture are you using (go env)? set GOARCH=amd64 set GOBIN= set GOEXE=.exe set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOOS=windows set GOPATH=C:\Go_workspace set GORACE= set

[go-nuts] Rational number to floating point

2016-09-19 Thread Mark Longtin
Hey guys, I'm new to Go - through the Ivy app on IOS- so I have a newbie question. What's the easiest way to cast or convert a rational number to its floating point representation? EG, looking for something like this: *float 355/113*3.14159292035 I could do something inelegant like

[go-nuts] Rational number to floating point

2016-09-19 Thread Tamás Gulácsi
float64(355)/113 -- 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. For more options, visit

Re: [go-nuts] Re: Alignment and Padding / Packing of structs

2016-09-19 Thread Ian Lance Taylor
On Mon, Sep 19, 2016 at 8:50 AM, Ali Demir wrote: > Header file won't have padding / alignment info. That would be a compiler > setting on the C side that is using the header. So the programmer needs to > setup C compiler in a way that is compatible with the go compiler. How

Re: [go-nuts] Install vim-go as a pacakge in vim 8

2016-09-19 Thread Johann Höchtl
Am Montag, 19. September 2016 13:51:17 UTC+2 schrieb Jan Mercl: > > On Sun, Sep 18, 2016 at 10:46 AM Johann Höchtl > wrote: > > > I thought Vim 8 packages are all automatic. vim-go commands like :help > vim-go or :GoUpdateBinaries do not work. > > Are you using the

[go-nuts] Re: Rational number to floating point

2016-09-19 Thread Hotei
I think you'll need something like x := float(355) / float(113) - where float is either float32 or float64 depending on your preferred trade-off for accuracy vs bytes required per number. On Monday, September 19, 2016 at 12:38:12 PM UTC-4, Mark Longtin wrote: > > Hey guys, > > I'm new to Go

Re: [go-nuts] fatal error:malloc deadlock

2016-09-19 Thread Ian Lance Taylor
On Mon, Sep 19, 2016 at 8:34 AM, Wanghb Wang wrote: > > when I use stattcpupprof in my program, I got fatal error malloc deadlock. > delete the cpu pprof, the program run well. > > > my question is : > Does startcpuprof infect the malloc or resulting OOM Problem I'm sorry, I

[go-nuts] Fast conversion. Tell me why I shouldn't.

2016-09-19 Thread badrelish
I don't like the extra allocation and copies involved when casting from byte slice to string or vice versa just because one type or the other is required. The code below reuses the data pointer and as far as I can tell in my tests so far, it even works well with garbage collection. My question

Re: [go-nuts] Fast conversion. Tell me why I shouldn't.

2016-09-19 Thread 'Paul Borman' via golang-nuts
As long as no one modifies the bytes in the byteslice. Go can no longer enforce that the string is immutable with this hack. On Mon, Sep 19, 2016 at 2:35 PM, wrote: > I don't like the extra allocation and copies involved when casting from > byte slice to string or vice

Re: [go-nuts] Compiler plugins or something?

2016-09-19 Thread Mateusz Czapliński
The pkg plugin is intended to allow writing "plugin-aware" Go apps, and plugins for them - cooperatively (that is, a "host" app must use this package and provide explicit "hook" points for plugins). The idea is outlined (since quite long ago) at the link mentioned by Ian L.T. earlier:

Re: [go-nuts] How to implement In Golang

2016-09-19 Thread James
Try this tutorial: http://go-database-sql.org/ On 20 September 2016 at 03:42, kumargv wrote: > import MySQLdb > > conn = MySQLdb.Connect( > host='localhost', user='user', > passwd='secret', db='test') > cursor = conn.cursor() > cursor.execute("SELECT this,that

[go-nuts] write in file the result of code

2016-09-19 Thread Dave Cheney
What did you expect to happen when you ran this program? What happened instead? -- 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

[go-nuts] SQL database connection

2016-09-19 Thread Dave Cheney
What did you expect to see when you ran that code? What did you see instead? -- 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

[go-nuts] SQL database connection

2016-09-19 Thread lochbm
Hello, everyone. I downloaded the SQL-connect driver for GOlang from GitHub and cannot seem to connect to my MYSQL database which was installed along with XAMPP. Below is the code: package main import( "fmt" "database/sql" _ "github.com/go-sql-driver" ) func main(){ mysql, err :=

[go-nuts] Re: Install vim-go as a pacakge in vim 8

2016-09-19 Thread Johann Höchtl
Guys, nobody using Vim 8 and the venerable go-vim plugin in Vim 8 as a package? Don't let me down on that! -- 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

[go-nuts] Re: Install vim-go as a pacakge in vim 8

2016-09-19 Thread Tamás Gulácsi
Nope, I'm on neovim (with plug for the plugins) for a long time now... -- 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.

[go-nuts] Re: write in file the result of code

2016-09-19 Thread Anonymous
here is my code : package main import ( "fmt" "math/big" "log" "os" "github.com/btcsuite/btcd/btcec" "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcutil" "github.com/btcsuite/btcutil/base58" ) func main() { // Print header //

Re: [go-nuts] Newbie Struggling w/ Hashing

2016-09-19 Thread Jesse McNelis
On 20 Sep 2016 9:03 a.m., "Robert Solomon" wrote: > > FileReadBuffer := make([]byte,ReadBufferSize); > for { // Repeat Until eof loop. > n,err := TargetFile.Read(FileReadBuffer); > if n == 0 || err == io.EOF { break } > check(err," Unexpected error

[go-nuts] Newbie Struggling w/ Hashing

2016-09-19 Thread Robert Solomon
Hi. I'm trying to learn Go after many years of using a different language. My development machine runs Ubuntu 16.04 amd64, go 1.6.2 linux/amd I compared the output of the following code, and my output differs from the std utilities such as sha1sum, sha215sum, etc. I used

Re: [go-nuts] Re: Alignment and Padding / Packing of structs

2016-09-19 Thread Ali Demir
Yes, so what you are describing to me needs to be told to the C compiler users in a formal way so that they make sure their alignment is the same as Go. Thanks. On Mon, Sep 19, 2016 at 2:27 PM, Ian Lance Taylor wrote: > On Mon, Sep 19, 2016 at 2:08 PM, Ali Demir

Re: [go-nuts] Calling a Go function from asm ("fatal error: missing stackmap")

2016-09-19 Thread Ian Lance Taylor
On Mon, Sep 19, 2016 at 3:56 PM, Caleb Spare wrote: > I'm trying to call a Go function from asm and I'm having trouble figuring > out the details. > > (In the past I've always endeavored to avoid this situation and make all my > asm functions be leaf functions, but in my

Re: [go-nuts] Re: Fast conversion. Tell me why I shouldn't.

2016-09-19 Thread 'Paul Borman' via golang-nuts
In theory the compiler can be smart enough, if it knows that the string passed to fmt.Println is not stored and re-used someplace, but I do not believe that is currently true. It probably has at least 2 copies, one to the string in your code and a second one to make it a []byte to pass to the

Re: [go-nuts] Re: Alignment and Padding / Packing of structs

2016-09-19 Thread Ali Demir
Packing option is explicitly specified for VC++: https://msdn.microsoft.com/en-us/library/xh3e3fd0.aspx The user needs to make sure whatever they pick (or default) in their project matches what Go compiler used. So it may help to specify what go compiler is using. On Mon, Sep 19, 2016 at 10:00

[go-nuts] memory profiler for benchmark test reports 0s across the board

2016-09-19 Thread 'Ethan Kennedy' via golang-nuts
I've got a function that reads `map[string]interface{}` off a channel, processing each one until that channel is closed. Processing each `map` entails allocating some slices and other data structures, grouping by like keys, etc. I've got a benchmark that reads 1 rows of JSON from a file,

Re: [go-nuts] SQL database connection

2016-09-19 Thread Harald Weidner
Hello, On Mon, Sep 19, 2016 at 01:37:14AM -0700, loc...@gmail.com wrote: > import( > _ "github.com/go-sql-driver" > ) The correct name of this package is: github.com/go-sql-driver/mysql Harald -- You received this message because you are subscribed to the Google Groups "golang-nuts" group.

[go-nuts] Re: write in file the result of code

2016-09-19 Thread Dave Cheney
I'm sorry this did not fix your problem. Can you please try to explain your problem, I don't think I understand what the issue you are having is. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving

[go-nuts] Re: write in file the result of code

2016-09-19 Thread Anonymous
it changes nothing :( -- 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. For more options, visit

[go-nuts] memory profiler for benchmark test reports 0s across the board

2016-09-19 Thread Dave Cheney
Try b.ReportAllocs() before your benchmark loop. That's the easiest way to benchmark the allocations per operation. -- 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

Re: [go-nuts] interpreting in a traceback

2016-09-19 Thread Alex Flint
Thanks Ian. Just to confirm: it's not possible that the dynamic type of x as seen from Go code would be ExplicitFunc, but the interface stores a *ExplicitFunc internally within the itab, and so the compiler generates (*ExplicitFunc).Call? On Mon, Sep 19, 2016 at 3:46 PM Ian Lance Taylor

Re: [go-nuts] Re: Fast conversion. Tell me why I shouldn't.

2016-09-19 Thread 'Paul Borman' via golang-nuts
A string is immutable, a byte slice is not. Suppose you have: b := []byte("hello world") s := string(b) fmt.Println(s) b[0] = 'H' fmt.Println(s) What is printed? hello world hello word Using the OPs function: b := []byte("hello world") s := fastBytesToString(b) fmt.Println(s) b[0] = 'H'

Re: [go-nuts] interpreting in a traceback

2016-09-19 Thread Ian Lance Taylor
On Mon, Sep 19, 2016 at 3:49 PM, Alex Flint wrote: > > Just to confirm: it's not possible that the dynamic type of x as seen from > Go code would be ExplicitFunc, but the interface stores a *ExplicitFunc > internally within the itab, and so the compiler generates >

[go-nuts] Calling a Go function from asm ("fatal error: missing stackmap")

2016-09-19 Thread Caleb Spare
I'm trying to call a Go function from asm and I'm having trouble figuring out the details. (In the past I've always endeavored to avoid this situation and make all my asm functions be leaf functions, but in my current use case it would be most helpful to be able to call a Go helper.) See the