Re: [go-nuts] CGO: __DARWIN_NULL weirdness

2017-06-11 Thread andrey mirtchovski
I found it: I had a typo writing "C.nil" instead of "nil". thanks for your help!

On Sun, Jun 11, 2017 at 9:31 PM, Ian Lance Taylor  wrote:
> On Sun, Jun 11, 2017 at 7:56 PM, andrey mirtchovski
>  wrote:
>>
>> I have a piece of cgo code which doesn't do much, but links a lot of
>> libraries in. As far as I can tell all my includes are there and they
>> shouldn't stomp on each other (they don't when compiled in C), however
>> with cgo I get the following weirdness:
>>
>> $ go build
>> # mypkg
>> Undefined symbols for architecture x86_64:
>>   "___DARWIN_NULL", referenced from:
>>   __cgohack___DARWIN_NULL in _cgo_main.o
>>  (maybe you meant: __cgohack___DARWIN_NULL)
>> ld: symbol(s) not found for architecture x86_64
>> clang: error: linker command failed with exit code 1 (use -v to see 
>> invocation)
>>
>> If I decide to be bold and #define __DARWIN_NULL in my Cgo preamble
>> (before "import C"), I get the following:
>>
>> $ go build
>> # mypkg
>> ./main.go:53:9: warning: '__DARWIN_NULL' macro redefined [-Wmacro-redefined]
>> /usr/include/sys/_types.h:52:9: note: previous definition is here
>>
>> I'm a little bit stumped. How to debug the chain on #includes to get
>> to the bottom of this? Why is this not a problem elsewhere?
>
> Presumably your Go code is referring to C.__DARWIN_NULL.  In some
> cases that will cause cgo to generate C code that looks like
> extern char __DARWIN_NULL[];
> void *_cgohack___DARWIN_NULL = __DARWIN_NULL;
> This kind of thing works for a variable or function, but not for a
> macro.  This may be a version of https://golang.org/issue/18720.  The
> simplest fix is to write, in your C preamble,
> void *my_DARWIN_NULL = __DARWIN_NULL; // use the appropriate type here
> and then refer to C.my_DARWIN_NULL in your Go code.
>
> Ian

-- 
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 https://groups.google.com/d/optout.


[go-nuts] Re: Go install speedup within docker

2017-06-11 Thread James Pettyjohn
Hey Vlad,

Here's the docker command:

docker run -ti --rm \
 -v "$PWD":/usr/src/pjt \
 -w /usr/src/pjt \
 -e "GOPATH=/usr/src/pjt" -e "STATICBUILD=1" \
 -e "PREBUILD_DEPS=$PREBUILD_DEPS" \
gobuilder:1.8-alpine \
 ./build.sh

Regarding my docker:
docker-machine version 0.10.0, build 76ed2a6
Client:
 Version:  17.03.0-ce
 API version:  1.26
 Go version:   go1.7.5
 Git commit:   60ccb22
 Built:Thu Mar  2 01:11:00 2017
 OS/Arch:  darwin/amd64

Server:
 Version:  17.03.0-ce
 API version:  1.26 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   3a232c8
 Built:Tue Feb 28 07:52:04 2017
 OS/Arch:  linux/amd64
 Experimental: false

Running on macOS.

Best,
James

On Sunday, June 11, 2017 at 7:00:18 AM UTC-7, Vladimir Varankin wrote:
>
> Hey James, 
>
> Could you show the docker run command, which you invoke to enter a 
> container? 
>
> I use docker to build my application as well, so I just do `docker 
> container run --rm -ti --volume $PWD:/gocode/src/app --workdir 
> /gocode/src/app  go build`. Doing so with container 
> reusage or not, I haven't found any speed difference so far.

-- 
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 https://groups.google.com/d/optout.


Re: [go-nuts] CGO: __DARWIN_NULL weirdness

2017-06-11 Thread Ian Lance Taylor
On Sun, Jun 11, 2017 at 7:56 PM, andrey mirtchovski
 wrote:
>
> I have a piece of cgo code which doesn't do much, but links a lot of
> libraries in. As far as I can tell all my includes are there and they
> shouldn't stomp on each other (they don't when compiled in C), however
> with cgo I get the following weirdness:
>
> $ go build
> # mypkg
> Undefined symbols for architecture x86_64:
>   "___DARWIN_NULL", referenced from:
>   __cgohack___DARWIN_NULL in _cgo_main.o
>  (maybe you meant: __cgohack___DARWIN_NULL)
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see 
> invocation)
>
> If I decide to be bold and #define __DARWIN_NULL in my Cgo preamble
> (before "import C"), I get the following:
>
> $ go build
> # mypkg
> ./main.go:53:9: warning: '__DARWIN_NULL' macro redefined [-Wmacro-redefined]
> /usr/include/sys/_types.h:52:9: note: previous definition is here
>
> I'm a little bit stumped. How to debug the chain on #includes to get
> to the bottom of this? Why is this not a problem elsewhere?

Presumably your Go code is referring to C.__DARWIN_NULL.  In some
cases that will cause cgo to generate C code that looks like
extern char __DARWIN_NULL[];
void *_cgohack___DARWIN_NULL = __DARWIN_NULL;
This kind of thing works for a variable or function, but not for a
macro.  This may be a version of https://golang.org/issue/18720.  The
simplest fix is to write, in your C preamble,
void *my_DARWIN_NULL = __DARWIN_NULL; // use the appropriate type here
and then refer to C.my_DARWIN_NULL in your Go code.

Ian

-- 
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 https://groups.google.com/d/optout.


[go-nuts] Re: mixed C / Go debugging

2017-06-11 Thread brainman
Thank you very much for instructions. I could reproduce what you see.

Unfortunately I do not have much to suggest.

dlv expects executable to be written in Go. dlv searches executable for 
particular symbols (among many other things). That is why you see "could 
not get Go symbols no runtime.pclntab symbol found" message.

So that leaves you with gdb. If you add -g flag to your both gcc and g++ 
commands, that will include dwarf info. Then you can use gdb:

c:\Users\Alex\dev\src\alain_mellan>gdb dload.exe
GNU gdb (GDB) 7.7.50.20140303-cvs
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 

This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.
For help, type "help".
Type "apropos word" to search for commands related to "word".

This binary was built by Equation Solution ...
Reading symbols from dload.exe...done.
(gdb) b dload.cpp:22
Breakpoint 1 at 0x40159c: file dload.cpp, line 22.
(gdb) r
Starting program: c:\Users\Alex\dev\src\alain_mellan\dload.exe
[New Thread 4020.0x868]

Breakpoint 1, main () at dload.cpp:22
22 funci();
(gdb) br 'main.SayHello'
Breakpoint 2 at 0x6249e050: file 
c:/Users/Alex/dev/src/alain_mellan/sayhello.go, line 8.
(gdb) c
Continuing.
[New Thread 4020.0x7bc]
[New Thread 4020.0xee8]
[New Thread 4020.0x7dc]
[New Thread 4020.0xd04]

Breakpoint 2, main.SayHello () at 
c:/Users/Alex/dev/src/alain_mellan/sayhello.go:8
8 func SayHello() {
(gdb) l
3
4 import "C"
5 import "fmt"
6
7 //export SayHello
8 func SayHello() {
9 fmt.Printf("Hello!\n")
10 fmt.Scanln()
11 fmt.Printf("Goodbye\n")
12 }
(gdb) bt
#0 main.SayHello () at c:/Users/Alex/dev/src/alain_mellan/sayhello.go:8
#1 0x6249e037 in main._cgoexpwrap_961c5413714f_SayHello ()
at command-line-arguments/_obj/_cgo_gotypes.go:45
#2 0x6244f6f2 in runtime.call32 () at 
c:/users/alex/dev/go/src/runtime/asm_amd64.s:509
#3 0x6240320a in runtime.cgocallbackg1 (ctxt=0)
at c:/users/alex/dev/go/src/runtime/cgocall.go:305
#4 0x62402fba in runtime.cgocallbackg (ctxt=0)
at c:/users/alex/dev/go/src/runtime/cgocall.go:187
#5 0x62450d4f in runtime.cgocallback_gofunc ()
at c:/users/alex/dev/go/src/runtime/asm_amd64.s:762
#6 0x62451ab1 in runtime.goexit () at 
c:/users/alex/dev/go/src/runtime/asm_amd64.s:2337
#7 0x in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb)

I doubt whether gdb is very useful.

Maybe create an issue at https://github.com/derekparker/delve/issues. Maybe 
Delve Team might have suggestions.

Sorry it took me a while to get back to you.

Alex

-- 
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 https://groups.google.com/d/optout.


[go-nuts] CGO: __DARWIN_NULL weirdness

2017-06-11 Thread andrey mirtchovski
I have a piece of cgo code which doesn't do much, but links a lot of
libraries in. As far as I can tell all my includes are there and they
shouldn't stomp on each other (they don't when compiled in C), however
with cgo I get the following weirdness:

$ go build
# mypkg
Undefined symbols for architecture x86_64:
  "___DARWIN_NULL", referenced from:
  __cgohack___DARWIN_NULL in _cgo_main.o
 (maybe you meant: __cgohack___DARWIN_NULL)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

If I decide to be bold and #define __DARWIN_NULL in my Cgo preamble
(before "import C"), I get the following:

$ go build
# mypkg
./main.go:53:9: warning: '__DARWIN_NULL' macro redefined [-Wmacro-redefined]
/usr/include/sys/_types.h:52:9: note: previous definition is here

I'm a little bit stumped. How to debug the chain on #includes to get
to the bottom of this? Why is this not a problem elsewhere?

-- 
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 https://groups.google.com/d/optout.


[go-nuts] Re: dial io timeout and tcp short connection performance bottleneck

2017-06-11 Thread 刘桂祥
Hi Darkofday:
   I doubt that if the client's local port is  used out, it should't 
 return dail io timeout
   I use one client with less worker it don't have dial timeout and 
when another client with the same worker count to bench the server,  now 
 two clients have dial io  timeout  
   so I guess the performance bottleneck  is in the server

在 2017年6月12日星期一 UTC+8上午8:54:20,Darkofday Darkofday写道:
>
> Maybe your client's local ports is used out. threre are only about 65000 
> ports you can use to make a connection from a client to server per IP. You 
> can check output of netstat to confirm that. 
>
> On Sunday, June 11, 2017 at 9:48:30 AM UTC+8, 刘桂祥 wrote:
>>
>> //question
>> > I write a simple golang tcp server
>> > and use tcp short connect client to bench it.
>> > when qps up to 28K,  client have many dial i/o timeout
>> > 
>> > I don't know what is the performance bottleneck??
>> > 
>> > I modify the server:
>> > cat /proc/sys/net/ipv4/tcp_max_syn_backlog1024
>> > cat /proc/sys/net/core/somaxconn  1024
>>
>> //a simple golang tcp server
>> 
>>package main
>> 
>> import (
>> "io"
>> "log"
>> "net"
>> )
>> 
>> func init() {
>> log.SetFlags(log.LstdFlags | log.Lshortfile)
>> }
>> func main() {
>> tcpAddr, err := net.ResolveTCPAddr("tcp", ":")
>> if err != nil {
>> log.Println(err)
>> return
>> }   
>> tcpListener, err := net.ListenTCP("tcp", tcpAddr)
>> if err != nil {
>> log.Println(err)
>>return
>> }   
>> defer tcpListener.Close()
>> 
>> for {
>> tcpConn, err := tcpListener.AcceptTCP()
>> if err != nil {
>> log.Println(err)
>> continue
>> }
>> go handle(tcpConn)
>> }
>> 
>> }
>> func handle(conn *net.TCPConn) {
>> //log.Println(conn.RemoteAddr().String())
>> 
>> buf := make([]byte, 1024)
>> for {
>> _, err := conn.Read(buf)
>> if err != nil {
>> if err != io.EOF {
>> log.Println(err)
>> }
>> return
>> }
>> 
>> _, err = conn.Write([]byte{'h', 'e', 'l', 'l', 'o'})
>> 
>> if err != nil {
>> log.Println(err)
>> }
>> }
>> }
>> 
>> // tcp short connection bench
>>
>> package main
>> 
>> import (
>> "log"
>> "net"
>> "sync"
>> "time"
>> )
>> 
>> var (
>> wg sync.WaitGroup
>> )
>> 
>> func init() {
>> log.SetFlags(log.LstdFlags | log.Lshortfile)
>> }
>> func main() {
>> 
>> for i := 0; i < 150; i++ {
>> wg.Add(1)
>> go func() {
>> for {
>> req()
>> time.Sleep(10 * time.Millisecond)
>> }
>> wg.Done()
>> }()
>> }
>> wg.Wait()
>> }
>> // tcp req
>> func req() {
>> conn, err := net.DialTimeout("tcp", "192.168.67.133:", 
>> 300*time.Millisecond)
>> if err != nil {
>> log.Println(err)
>> return
>> }
>> // conn.SetDeadline(time.Now().Add(300 * time.Millisecond))
>> defer conn.Close()
>> _, err = conn.Write([]byte("client"))
>> if err != nil {
>> log.Println(err)
>> return
>> }
>> buf := make([]byte, 1024)
>> _, err = conn.Read(buf)
>> if err != nil {
>> log.Println(err)
>> }
>> }
>>
>

-- 
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 https://groups.google.com/d/optout.


Re: [go-nuts] glog with logrotate

2017-06-11 Thread Shawn Milochik
If it logs to stdout, you could try lc (log catcher).

https://github.com/shawnmilo/lc

About as simple as possible.  I hope you find it useful.

-- 
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 https://groups.google.com/d/optout.


[go-nuts] Re: dial io timeout and tcp short connection performance bottleneck

2017-06-11 Thread hongf . yue
Maybe your client's local ports is used out. threre are only about 65000 
ports you can use to make a connection from a client to server per IP. You 
can check output of netstat to confirm that. 

On Sunday, June 11, 2017 at 9:48:30 AM UTC+8, 刘桂祥 wrote:
>
> //question
> > I write a simple golang tcp server
> > and use tcp short connect client to bench it.
> > when qps up to 28K,  client have many dial i/o timeout
> > 
> > I don't know what is the performance bottleneck??
> > 
> > I modify the server:
> > cat /proc/sys/net/ipv4/tcp_max_syn_backlog1024
> > cat /proc/sys/net/core/somaxconn  1024
>
> //a simple golang tcp server
> 
>package main
> 
> import (
> "io"
> "log"
> "net"
> )
> 
> func init() {
> log.SetFlags(log.LstdFlags | log.Lshortfile)
> }
> func main() {
> tcpAddr, err := net.ResolveTCPAddr("tcp", ":")
> if err != nil {
> log.Println(err)
> return
> }   
> tcpListener, err := net.ListenTCP("tcp", tcpAddr)
> if err != nil {
> log.Println(err)
>return
> }   
> defer tcpListener.Close()
> 
> for {
> tcpConn, err := tcpListener.AcceptTCP()
> if err != nil {
> log.Println(err)
> continue
> }
> go handle(tcpConn)
> }
> 
> }
> func handle(conn *net.TCPConn) {
> //log.Println(conn.RemoteAddr().String())
> 
> buf := make([]byte, 1024)
> for {
> _, err := conn.Read(buf)
> if err != nil {
> if err != io.EOF {
> log.Println(err)
> }
> return
> }
> 
> _, err = conn.Write([]byte{'h', 'e', 'l', 'l', 'o'})
> 
> if err != nil {
> log.Println(err)
> }
> }
> }
> 
> // tcp short connection bench
>
> package main
> 
> import (
> "log"
> "net"
> "sync"
> "time"
> )
> 
> var (
> wg sync.WaitGroup
> )
> 
> func init() {
> log.SetFlags(log.LstdFlags | log.Lshortfile)
> }
> func main() {
> 
> for i := 0; i < 150; i++ {
> wg.Add(1)
> go func() {
> for {
> req()
> time.Sleep(10 * time.Millisecond)
> }
> wg.Done()
> }()
> }
> wg.Wait()
> }
> // tcp req
> func req() {
> conn, err := net.DialTimeout("tcp", "192.168.67.133:", 
> 300*time.Millisecond)
> if err != nil {
> log.Println(err)
> return
> }
> // conn.SetDeadline(time.Now().Add(300 * time.Millisecond))
> defer conn.Close()
> _, err = conn.Write([]byte("client"))
> if err != nil {
> log.Println(err)
> return
> }
> buf := make([]byte, 1024)
> _, err = conn.Read(buf)
> if err != nil {
> log.Println(err)
> }
> }
>

-- 
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 https://groups.google.com/d/optout.


[go-nuts] glog with logrotate

2017-06-11 Thread Kumkum
Hi,

Is there an easy way to use logrotate with golang/glog 
(https://github.com/golang/glog) ?

That is, how do I prevent glog from creating separate log files each time 
it starts (i.e., with timestamp in the file name)?

Thanks!


-- 
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 https://groups.google.com/d/optout.


[go-nuts] Re: [ANN] Gomail v2: sending emails faster

2017-06-11 Thread Tamás Gulácsi
What do you mean by "lots of tedious manual works"?
You have to specify where shall those emails appear, (embed `` into the body),
or you can just Attach those files to the email.

 
2017. június 11., vasárnap 16:47:54 UTC+2 időpontban Antonio Sun a 
következőt írta:
>
> Hey Alex,
>
> Can gomail supports embedding *a lot* of images?
>
> From
> https://godoc.org/gopkg.in/gomail.v2#Message.Embed
> it seems that gomail only support embedding one image, if we embed a lot 
> of them, there are still lots of tedious manual works to make it works. 
>
> Right?
>
>
> On Monday, May 30, 2016 at 9:41:28 PM UTC-4, Tong Sun wrote:
>>
>> Nice Alexandre. 
>>
>> Can Gomail  send email using SSL 
>> but not TLS? I.e., basically doing this:
>> https://gist.github.com/chrisgillis/10888032
>>
>> Could you show me how to do it please? I looked at 
>> https://godoc.org/gopkg.in/gomail.v2, but haven't figured out the way. I 
>> also found a historic message with this:
>>
>>  d := gomail.Dialer{Host: "localhost", Port: 587, SSL: false, TLSConfig: nil}
>>
>>
>> but it doesn't work (and there is no answer either). 
>>
>> Please help. 
>> Thanks
>>
>> On Wednesday, September 2, 2015 at 7:55:26 AM UTC-4, Alexandre Cesaro 
>> wrote:
>>>
>>> Hi,
>>>
>>> I just released the second version of Gomail 
>>> .
>>>
>>> There are quite a few backward-incompatible changes 
>>>  since 
>>> Gomail v1 but it brings lots of good stuff:
>>>
>>>- A great focus was placed on performances. Gomail v2 is way more 
>>>efficient than Gomail v1 to send a large number of emails (see the 
>>>Daemon  
>>>or Newsletter 
>>> 
>>>examples).
>>>- The API is now clearer and way more flexible.
>>>- The documentation  improved 
>>>and many examples were added.
>>>- All existing issues have been closed.
>>>- The minimum Go version is now 1.2 instead of 1.3. No external 
>>>dependencies are used with Go 1.5.
>>>
>>> More info on Github: https://github.com/go-gomail/gomail
>>>
>>

-- 
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 https://groups.google.com/d/optout.


[go-nuts] Re: dial io timeout and tcp short connection performance bottleneck

2017-06-11 Thread mjstevenson
I meant the fully open connections waiting for application handling so the 
listen queue (somaxconn). On the client and server I'd check you aren't 
exhausting any of the more obvious limits, so ports/listen queues. Adding 
more virtual IPs is easy way to test the ports. Listen queues should show 
up in "netstat -s" as TPC drops. Increasing somaxconn should help unless 
you are CPU/network limited. It's very easy to hit a system limit and then 
think your programming is at fault.

-- 
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 https://groups.google.com/d/optout.


[go-nuts] interesting potential go event talk

2017-06-11 Thread Michael Jones
Atom: Horizontally Scaling Strong Anonymity

"To evaluate Atom, *we implemented an Atom prototype*
*in Go*, and tested it on a network of 1,024 Amazon EC2
machines. Our result shows that Atom can support more
than one million users sending microblogging messages with
28 minutes of latency. using 1,024 commodity machines.
(Processing this number of messages using Riposte [21], a
centralized anonymous microblogging system, would take
more than 11 hours.) Atom can also support a million users
dialing with 28 minutes of latency, with stronger guarantees
than prior systems [47, 68]."

https://arxiv.org/pdf/1612.07841.pdf

-- 
Michael T. Jones
michael.jo...@gmail.com

-- 
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 https://groups.google.com/d/optout.


[go-nuts] Re: Where can I find golang library for google cloud client library for using service account

2017-06-11 Thread prajakta . dandawate
Thank you. I will look into this. 

On Sunday, June 11, 2017 at 7:50:08 AM UTC-7, Dragos Harabor wrote:
>
> If you start chasing the code from a NewClient method, something like 
> https://godoc.org/cloud.google.com/go/bigquery#NewClient, you will end up 
> eventually at golang.org/x/oauth2/google. Reading the doc and code for 
> DefaultCredentials and FindDefaultCredentials may answer all your questions:
> https://godoc.org/golang.org/x/oauth2/google#DefaultCredentials
>
> You may also be interested in joining GCP Slack for these types of 
> specific questions:
> https://gcp-slack.appspot.com/
>
> On Saturday, June 10, 2017 at 11:18:51 PM UTC-7, Prajakta Dandawate wrote:
>>
>> Hello All ,
>>
>> Thank you. 
>>
>> Where do I find the package which uses service account to get the client 
>> and make Compute calls?
>> Is it possible to avoid oAuth/http calls, because if I use Oauth, I have 
>> to worry about getting token and renew.
>> Could anyone tell where is the piece of code which uses service account 
>> json for auth.
>>
>>
>> On Saturday, June 10, 2017 at 7:02:44 PM UTC-7, Dragos Harabor wrote:
>>>
>>> https://godoc.org/cloud.google.com/go
>>>
>>> https://github.com/GoogleCloudPlatform/google-cloud-go
>>>
>>> https://godoc.org/google.golang.org/api
>>>
>>> https://cloud.google.com/go/docs/
>>>
>>>
>>> On Friday, June 9, 2017 at 5:21:04 PM UTC-7, Prajakta Dandawate wrote:

 I am looking for the client library for Google cloud platform (for 
 compute/networking, service account etc) equivalent to amazon's

 github.com/aws/aws-sdk-go/service 

 for Google cloud platform. 


 After searching on the internet I could not identify and get the right 
 library. 

 Please share the link if anyone has.


 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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Where can I find golang library for google cloud client library for using service account

2017-06-11 Thread Dragos Harabor
If you start chasing the code from a NewClient method, something 
like https://godoc.org/cloud.google.com/go/bigquery#NewClient, you will end 
up eventually at golang.org/x/oauth2/google. Reading the doc and code for 
DefaultCredentials and FindDefaultCredentials may answer all your questions:
https://godoc.org/golang.org/x/oauth2/google#DefaultCredentials

You may also be interested in joining GCP Slack for these types of specific 
questions:
https://gcp-slack.appspot.com/

On Saturday, June 10, 2017 at 11:18:51 PM UTC-7, Prajakta Dandawate wrote:
>
> Hello All ,
>
> Thank you. 
>
> Where do I find the package which uses service account to get the client 
> and make Compute calls?
> Is it possible to avoid oAuth/http calls, because if I use Oauth, I have 
> to worry about getting token and renew.
> Could anyone tell where is the piece of code which uses service account 
> json for auth.
>
>
> On Saturday, June 10, 2017 at 7:02:44 PM UTC-7, Dragos Harabor wrote:
>>
>> https://godoc.org/cloud.google.com/go
>>
>> https://github.com/GoogleCloudPlatform/google-cloud-go
>>
>> https://godoc.org/google.golang.org/api
>>
>> https://cloud.google.com/go/docs/
>>
>>
>> On Friday, June 9, 2017 at 5:21:04 PM UTC-7, Prajakta Dandawate wrote:
>>>
>>> I am looking for the client library for Google cloud platform (for 
>>> compute/networking, service account etc) equivalent to amazon's
>>>
>>> github.com/aws/aws-sdk-go/service 
>>>
>>> for Google cloud platform. 
>>>
>>>
>>> After searching on the internet I could not identify and get the right 
>>> library. 
>>>
>>> Please share the link if anyone has.
>>>
>>>
>>> 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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: [ANN] Gomail v2: sending emails faster

2017-06-11 Thread antoniosun001
Hey Alex,

Can gomail supports embedding *a lot* of images?

From
https://godoc.org/gopkg.in/gomail.v2#Message.Embed
it seems that gomail only support embedding one image, if we embed a lot of 
them, there are still lots of tedious manual works to make it works. 

Right?


On Monday, May 30, 2016 at 9:41:28 PM UTC-4, Tong Sun wrote:
>
> Nice Alexandre. 
>
> Can Gomail  send email using SSL but 
> not TLS? I.e., basically doing this:
> https://gist.github.com/chrisgillis/10888032
>
> Could you show me how to do it please? I looked at 
> https://godoc.org/gopkg.in/gomail.v2, but haven't figured out the way. I 
> also found a historic message with this:
>
>  d := gomail.Dialer{Host: "localhost", Port: 587, SSL: false, TLSConfig: nil}
>
>
> but it doesn't work (and there is no answer either). 
>
> Please help. 
> Thanks
>
> On Wednesday, September 2, 2015 at 7:55:26 AM UTC-4, Alexandre Cesaro 
> wrote:
>>
>> Hi,
>>
>> I just released the second version of Gomail 
>> .
>>
>> There are quite a few backward-incompatible changes 
>>  since 
>> Gomail v1 but it brings lots of good stuff:
>>
>>- A great focus was placed on performances. Gomail v2 is way more 
>>efficient than Gomail v1 to send a large number of emails (see the 
>>Daemon  
>>or Newsletter 
>> 
>>examples).
>>- The API is now clearer and way more flexible.
>>- The documentation  improved 
>>and many examples were added.
>>- All existing issues have been closed.
>>- The minimum Go version is now 1.2 instead of 1.3. No external 
>>dependencies are used with Go 1.5.
>>
>> More info on Github: https://github.com/go-gomail/gomail
>>
>

-- 
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 https://groups.google.com/d/optout.


[go-nuts] Go install speedup within docker

2017-06-11 Thread Vladimir Varankin
Hey James,

Could you show the docker run command, which you invoke to enter a container?

I use docker to build my application as well, so I just do `docker container 
run --rm -ti --volume $PWD:/gocode/src/app --workdir /gocode/src/app 
 go build`. Doing so with container reusage or not, I 
haven't found any speed difference so far.

-- 
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 https://groups.google.com/d/optout.


[go-nuts] Re: Completeness of Golang drivers for open-source and enterprise databases.

2017-06-11 Thread Asif Jalil
For DB2 driver, please see the following:

https://github.com/asifjalil/cli

Thanks. 

Asif

On Saturday, June 10, 2017 at 6:13:27 AM UTC-4, hari.e...@gmail.com wrote:
>
>
> Thanks a lot for responding *Tamás Gulácsi*.
>
> One more question. The link2 stated does not have the status of SAP Hana, 
> Sybase and Db2 drivers ?
>
> Do you have an idea on the states of these drivers ?
>
> Thanks and regards,
> Hariharan.
>
> On Friday, June 9, 2017 at 10:01:42 AM UTC+5:30, Tamás Gulácsi wrote:
>>
>> ora.v4:
>> Query1 : Is the status mentioned in link2 is up-to-date ?
>> Yes
>>
>> Query2 : Have anybody tried these drivers in production systems ?
>> Yes
>>
>> Query3 : Does these drivers provide APIs to fetch the schema (column 
>> names, column/value types) of tables in DBs?
>> Yes: SQL.
>> Just "SELECT * FROM user_tab_cols".
>>
>>

-- 
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 https://groups.google.com/d/optout.


Re: [go-nuts] golang thrift server 28k/s request client many dial tcp timeout ,why??

2017-06-11 Thread 刘桂祥
I truely try with two client server to bench it; and the result  is the 
same, so I doubt the performance bottleneck 
 is in the 
server side 
but I don't konw the concrete  

question 


在 2017年6月11日星期日 UTC+8下午8:10:49,Jesper Louis Andersen写道:
>
> Hi!
>
> One thing you should check is the amount of TCP sessions you are starting 
> from one host. Since a TCP session is identified by the IP/Port in both 
> ends, and you communicate where some of those numbers stay the same, you 
> are probably limited to no more than 64000 ports at most (or such).
>
> If you run 28k reqs/s and you have a high time-wait timeout, you will run 
> out of ports quickly.
>
> A simple test is to have two "client" hosts and then checking if you can 
> run about the double amount through before getting into trouble.
>
> The other thing you should worry about is that if you are truly building 
> new TCP sessions every time you have a request, you pay the session setup 
> time on every request. You could maybe look into batch-framing some of them 
> which will improve the TCP window and likely increase throughput.
>
> On Sat, Jun 10, 2017 at 11:51 AM 刘桂祥  
> wrote:
>
>>  I just want to bench the simple server accept new connection
>>  now I create a new simple tcp server and use tcp short connection to 
>> bench it
>>  the result is also that  client have many dial i/o timeout
>>  does it is client's question ??
>>
>> 在 2017年6月9日星期五 UTC+8下午9:28:55,Shawn Milochik写道:
>>
>>> I think the setting is more likely to need an increase on the client 
>>> than the server. 
>>>
>>> Are you using HTTP/1 or HTTP/2? If HTTP/1, set the MaxIdleConnsPerHost 
>>> value on your client's Transport.
>>>
>>> More info:
>>>
>>> https://golang.org/pkg/net/http/#Transport
>>> https://paperairoplane.net/?p=556
>>>
>> -- 
>> 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...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 https://groups.google.com/d/optout.


[go-nuts] Re: dial io timeout and tcp short connection performance bottleneck

2017-06-11 Thread 刘桂祥
HI Matthew:
   Because I don't konw the performance bottleneck;  do you mean the 
tcp syn queue (half open queue) is full ??but I don't see the syn flood 
warn message in /var/log/messages

在 2017年6月11日星期日 UTC+8下午7:03:58,Matthew Stevenson写道:
>
> Are you exhausting the local TCP sockets? Some (50k?) in a wait state? Try 
> using a few IP addresses on the test box. Increase 
> /proc/sys/net/core/somaxconn to a larger value, if you have a 20 
> millisecond pause at 28kreqs/sec then thats 500 ish connections so 1024 may 
> not be enough.
>

-- 
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 https://groups.google.com/d/optout.


Re: [go-nuts] golang thrift server 28k/s request client many dial tcp timeout ,why??

2017-06-11 Thread Jesper Louis Andersen
Hi!

One thing you should check is the amount of TCP sessions you are starting
from one host. Since a TCP session is identified by the IP/Port in both
ends, and you communicate where some of those numbers stay the same, you
are probably limited to no more than 64000 ports at most (or such).

If you run 28k reqs/s and you have a high time-wait timeout, you will run
out of ports quickly.

A simple test is to have two "client" hosts and then checking if you can
run about the double amount through before getting into trouble.

The other thing you should worry about is that if you are truly building
new TCP sessions every time you have a request, you pay the session setup
time on every request. You could maybe look into batch-framing some of them
which will improve the TCP window and likely increase throughput.

On Sat, Jun 10, 2017 at 11:51 AM 刘桂祥  wrote:

>  I just want to bench the simple server accept new connection
>  now I create a new simple tcp server and use tcp short connection to
> bench it
>  the result is also that  client have many dial i/o timeout
>  does it is client's question ??
>
> 在 2017年6月9日星期五 UTC+8下午9:28:55,Shawn Milochik写道:
>
>> I think the setting is more likely to need an increase on the client than
>> the server.
>>
>> Are you using HTTP/1 or HTTP/2? If HTTP/1, set the MaxIdleConnsPerHost
>> value on your client's Transport.
>>
>> More info:
>>
>> https://golang.org/pkg/net/http/#Transport
>> https://paperairoplane.net/?p=556
>>
> --
> 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 https://groups.google.com/d/optout.
>

-- 
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 https://groups.google.com/d/optout.


[go-nuts] Looking for a Go Mentor (paid)

2017-06-11 Thread simran
Hi All,
I get time on and off to do a bit of Go… i could be classified as a tinkerer at
a very junior level (although i have been programming for a long time; i just
haven't had enough hands on experience with Go to really get the hang of
libraries and what "good architecture" in Go would look like as my "day job"
does not include any coding any more).
What i am looking for is a mentor that can guide me through things as i hit road
blocks and really help me in a hands-on way reach solutions.
The project i have taken for myself to do is:
Get Data * Web page to enter a URL (eg. https://growsuper.com/ )
 * (very importantly, i want to ensure client-side javascript is
   executed, so that i can inspect any site properly - a simple GET in itself is
   not sufficient)
 * Extract information from the page and look for key things and follow
   the links to get more informaiton (eg. from their about us page see that they
   have a link to twitter, follow it and get their latest tweets)
 * Rinse and Repeat many times for various amounts of data
 * Extract information relating to the domain name (eg. effectively a
   whois and then parse)
 * Extract information about the security cert
 * Run an "nmap" scan to detect open ports or do some server / host
   detection

Save Data * At each step of the above, we will get data, i want to timestamp it
   and save it
 * (historically i have used RDBMS systems but happy to try out NoSQL,
   after discussion with mentor)

Present Data * On a separate web page, be able to read the saved data and
   represent it nice (preferably using angular or react (i don't know either) -
   i know HTML version 2 though ;)


I'm assuming we'll share the project via a private repo on github to start with,
and the OS i use to do anything/everything is Linux (Ubuntu).
I'm commonly just used "vim" and a very little bit of atom, but happy to
explore/expand and test some IDE's if my mentor advises me to (must be on linux
though).
So, what i am looking for is someone who can: * Spend a few hours with me to
   discuss the project - motive, desired outcomes, etc…
 * Help architect a solution that
   is a "good architect" as per Go's practices
 * Directory StructureFile StructureCode ArchitectureData Architecture
   / Struct's / etcHow to built and do unit tests

Ideally there will be someone who has taught others before (so that they can
dumify it to the level required) and/or is keen to mentor and of course
importantly, is very good at Go and understands all the above (Go architecture /
testing practices / best practices, etc).
I'm based in Sydney, so if the mentor is in Sydney, we can catchup in person for
a whiteboard session and then online; if the mentor is not in Sydney, then we
can jump straight to Google Hangouts or the likes (Weekends are better for me to
get a bit of coding done). What i'm anticipating is: * 3 hour initial mentor
   session; then
 * A few emails every
   fortnight or month with a google hangout every 3-4 weeks or so for an hour or
   two.

The pace will be slow as i have a number of things in parallel, but this i am
doing out of passion, so every moment i do get spare (couple of hours a week), i
will be trying to spend on this.
I'm anticipating paying you for your time of course, if you're happy to mentor
me in such a way, please email me and let me know; i'd also appreciate a link to
your github profile and the rate you would like to charge (if possible in AUD). 
I anticipate the paid relationship lasting 6-9 months on this project, and much
longer if you'll have me on further projects i dig into.
thanks,
simran.
ps: I know there are good meetups and free online resources, but i can't do
meetups (they are always evenings and i like to be home with the kids; and the
free resources are great, but AI is not quite there yet in terms of giving me
answers to questions it anticipates i will ask :)

-- 
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 https://groups.google.com/d/optout.


[go-nuts] Re: dial io timeout and tcp short connection performance bottleneck

2017-06-11 Thread mjstevenson
Are you exhausting the local TCP sockets? Some (50k?) in a wait state? Try 
using a few IP addresses on the test box. Increase 
/proc/sys/net/core/somaxconn to a larger value, if you have a 20 
millisecond pause at 28kreqs/sec then thats 500 ish connections so 1024 may 
not be enough.

-- 
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 https://groups.google.com/d/optout.


[go-nuts] Re: Where can I find golang library for google cloud client library for using service account

2017-06-11 Thread prajakta . dandawate
Hello All ,

Thank you. 

Where do I find the package which uses service account to get the client 
and make Compute calls?
Is it possible to avoid oAuth/http calls, because if I use Oauth, I have to 
worry about getting token and renew.
Could anyone tell where is the piece of code which uses service account 
json for auth.


On Saturday, June 10, 2017 at 7:02:44 PM UTC-7, Dragos Harabor wrote:
>
> https://godoc.org/cloud.google.com/go
>
> https://github.com/GoogleCloudPlatform/google-cloud-go
>
> https://godoc.org/google.golang.org/api
>
> https://cloud.google.com/go/docs/
>
>
> On Friday, June 9, 2017 at 5:21:04 PM UTC-7, Prajakta Dandawate wrote:
>>
>> I am looking for the client library for Google cloud platform (for 
>> compute/networking, service account etc) equivalent to amazon's
>>
>> github.com/aws/aws-sdk-go/service 
>>
>> for Google cloud platform. 
>>
>>
>> After searching on the internet I could not identify and get the right 
>> library. 
>>
>> Please share the link if anyone has.
>>
>>
>> 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.
For more options, visit https://groups.google.com/d/optout.