[go-nuts] Re: Proposal: Shared libraries in Go, take 2 (+linux/amd64 implementation)

2019-04-11 Thread Chao Chen
I don't understand initial exec TLS model. But I meet the following problem when use go shared library. *When I load Go shared library from python2.7 script on alpine 3.9 container.**Would you please give some suggestions? I am so appreciated for your help!* *When I call Go shared library from

[go-nuts] Go 1.12.4 and Go 1.11.9 are released

2019-04-11 Thread Andrew Bonventre
Hello gophers, We have just released Go versions 1.12.4 and 1.11.9, minor point releases. These releases fix an issue where using the prebuilt binary releases on older versions of GNU/Linux led to failures when linking programs that used cgo. Only

Re: [go-nuts] Re: Disable test result caching from within Go code?

2019-04-11 Thread Robert Engels
Where are you getting the idea that results are cached? I can't even figure out how that would be useful in a testing framework - do you mean it auto-mocks services based on past requests? I've seen nothing like this - are you sure you just don't have the wrong HTTP header fields, so the HTTP

[go-nuts] Re: buildmode=c-archive and statically linking into another lib

2019-04-11 Thread Chao Chen
*Do you any progress to solve the problem? I meet the same problem.* w hen I call golang build shared library on python from alpine 3.9 container.failed with OSError:

[go-nuts] Re: When slice decide to expand cap?

2019-04-11 Thread peterGo
jianfeng ye, Post text not images! Experiments that are not reproducible have no value. You posted low-contrast images of your experiments and results. Reproducing your results using OCR and/or typing is too hard and too error prone. My experiments are: $ go version go version devel

[go-nuts] Re: Disable test result caching from within Go code?

2019-04-11 Thread twpayne
OK, I guess that Go has no solution for this. On Friday, March 29, 2019 at 2:20:53 AM UTC+1, twp...@gmail.com wrote: > > I have a bunch of integration tests which depend on external services. > I've added the build tag "integration" for each source file containing such > tests so they are only

Re: [go-nuts] OCSP revocation checking before completing TLS handshake

2019-04-11 Thread Sam Whited
On Thu, Apr 11, 2019, at 15:49, erikssonfili...@gmail.com wrote: > Using Go's standard TLS library this does not seem possible, as > tls.Dial does not seem to do any OCSP checking. Another possible > workaround would be to fetch the server certificate without > performing a handshake, then check

Re: [go-nuts] Using C++ code with cgo

2019-04-11 Thread av
Works like charm. Thanks a lot. Here is my code: aptwrap.h #ifdef __cplusplus extern "C" { #endif void print(); #ifdef __cplusplus } #endif aptwrap.cpp #include "aptwrap.h" #include #include #include #ifdef __cplusplus extern "C" { #endif void print() { std::cout << "

Re: [go-nuts] Using C++ code with cgo

2019-04-11 Thread Marcin Romaszewicz
Wrap your C++ code in C. Create a header which is simply: cwrapper.h: void printSomething() Then you can have a cwrapper.cpp instead of your wrapper.hpp: #include extern "C" { void printSomething() { printf("Hello World"); } } Your C++ code will produce a function named printSomething

[go-nuts] Re: gcwaiting=1 will causes block all the goroutines?

2019-04-11 Thread jake6502
On Wednesday, April 10, 2019 at 10:44:38 PM UTC-4, mount...@gmail.com wrote: > > Thank you very much for your meticulous reply. I basically understand the > scheduling mechanism, but I still don’t understand the third paragraph. > > It is "It is also important to note that the behavior of

[go-nuts] Compile C++ with cgo

2019-04-11 Thread av
Hi *, I want to compile C++ code, because the library I need is C++ only. Here is my wrapper.hpp: #include void print() { std::cout << "Xx"; } And here is my main.go: package main // #cgo CXXFLAGS: -I. // #cgo CFLAGS: -I. // #cgo LDFLAGS: // #include "wrapper.hpp" import "C" func main() {

[go-nuts] OCSP revocation checking before completing TLS handshake

2019-04-11 Thread erikssonfilip95
Hi, I am required to, using Go, as a client do OCSP revocation checking of server certificate before completing a TLS handshake, i.e [initiate handshake -> get server cert -> check revocation status -> if revoked abort], and not [initiate handshake -> complete handshake -> check revocation

[go-nuts] Using C++ code with cgo

2019-04-11 Thread aleksandar . valchev
Hi *, I have following C++ code: wrapper.hpp: #include void printSomething() { printf("Hello World"); } And corresponding main.go: package main // #cgo CXXFLAGS: -I. // #cgo CFLAGS: -I. // #cgo LDFLAGS: // #include "wrapper.hpp" import "C" func main() { C.print() }

Re: [go-nuts] go test cover with args, coverage flag has been treat like an args.

2019-04-11 Thread Jan Mercl
On Thu, Apr 11, 2019 at 10:57 AM hui zhang wrote: > How to resolve this ? If you're not using any options in your program, just the arguments, you may do this: $ cat main.go package main import ( "flag" "fmt" ) func main() { flag.Parse()

[go-nuts] Re: go test cover with args, coverage flag has been treat like an args.

2019-04-11 Thread Robert Johnstone
Hello, I'd suggest wrapping your main to create a more testable interface. For example, see https://play.golang.org/p/_Zund5W4fb5. On Thursday, 11 April 2019 04:57:24 UTC-4, hui zhang wrote: > > my program take 4 args like > ./myprogram 1 2 3 4 > *args_len=: 5* > I want to test

Re: [go-nuts] Re: When slice decide to expand cap?

2019-04-11 Thread Jan Mercl
On Thu, Apr 11, 2019 at 12:21 PM jianfeng ye wrote: > > and i want to got the code where go build check slice's cap to decide where use growslice? You can find the source easily[x] but I think the more important question is why you need it. It's an implementation detail of the particular

[go-nuts] Re: When slice decide to expand cap?

2019-04-11 Thread jianfeng ye
and i want to got the code where go build check slice's cap to decide where use growslice? 在 2019年4月11日星期四 UTC+8下午6:19:30,jianfeng ye写道: > > Some article tell me when slice use append function, if slice's cap > is satisfy,it will not grow slice。 > > but I want to know when golang know the

Re: [go-nuts] how to use an instance across functions in a package w/o global vars

2019-04-11 Thread Dumitru Ungureanu
It helps a lot! Thanks. I now have two things to moan about. If I was to pass c around, I would added it to the params list. If I had more others, I'd built a struct. But now, if somehow I lose track of who's passing what and where, hard times debugging ahead. Having them declared at package

Re: [go-nuts] how to use an instance across functions in a package w/o global vars

2019-04-11 Thread Jan Mercl
On Thu, Apr 11, 2019 at 11:56 AM Dumitru Ungureanu wrote: > > Secondly, as far as my knowledge goes: > > your example is declaring the function in place, it doesn't pass the > variable around to another function The `w` variable is visible in the closure. Closure is a function + closed over

Re: [go-nuts] how to use an instance across functions in a package w/o global vars

2019-04-11 Thread Dumitru Ungureanu
First off, thank you for the time Jan. Secondly, as far as my knowledge goes: - your example is declaring the function in place, it doesn't pass the variable around to another function, i.e. goConect - my code evolved , so now, if I use a init func then it's off to init passing

[go-nuts] Re: go test cover on other platforms

2019-04-11 Thread Volker Dobler
On Thursday, 11 April 2019 11:08:16 UTC+2, hui zhang wrote: > > I am developing go on mac > but my test environment is on linux. > > Can I build a bin like > GOOS=linux GOARCH=amd64 go test -c && ./sum.test > > and do test on linux , and get a coverage report ? > how? > > Need install go

Re: [go-nuts] how to use an instance across functions in a package w/o global vars

2019-04-11 Thread Jan Mercl
On Wed, Apr 10, 2019 at 7:23 PM Dumitru Ungureanu wrote: > > In this particular case, w.DefineFunction Api does not acomodate such a > passing. Please explain why and/or what do you mean by that as I don't see where/what the problem is. > Reason I asked in the first place. Dependency injection

[go-nuts] go test cover on other platforms

2019-04-11 Thread hui zhang
I am developing go on mac but my test environment is on linux. Can I build a bin like GOOS=linux GOARCH=amd64 go test -c && ./sum.test and do test on linux , and get a coverage report ? how? Need install go environment on linux ? -- You received this message because you are subscribed to the

[go-nuts] go test cover with args, coverage flag has been treat like an args.

2019-04-11 Thread hui zhang
my program take 4 args like ./myprogram 1 2 3 4 *args_len=: 5* I want to test this program coverage so go test -coverprofile coverage.out -args 1 2 3 4 myprogram_test.go func Test_main(m *testing.T) { main() } DEBUG args=