[go-nuts] Using analysistest "want" with other comments

2020-11-26 Thread Miki Tebeka
Hi, I wrote a tool for validating regular expressions using golang.org/x/tools/go/analysis and want to test it using golang.org/x/tools/go/analysis/analysistest. The problem is that the tool is using comments to indicates line to check, which doesn't work well with the "// want" comments

Re: [go-nuts] Running "go test" modifies go.mod & go.sum

2020-11-02 Thread Miki Tebeka
alysis/internal/checker/checker.go#L152-L155 > > On Sun, 2020-11-01 at 04:52 -0800, Miki Tebeka wrote: > > I try to change the "go run" command to use "-mod=readonly", didn't > > help. > > > > On Sunday, November 1, 2020 at 10:23:07 AM UTC+2 ko

Re: [go-nuts] Running "go test" modifies go.mod & go.sum

2020-11-01 Thread Miki Tebeka
'll need to unconditionally pass -mod=readonly to go run in > the regression_test.go file, or find wether it's been passed to go test > and then conditionally pass it to go run. > > > On Sun, 2020-11-01 at 01:09 -0700, Miki Tebeka wrote: > > I *do* use "go tes

Re: [go-nuts] Running "go test" modifies go.mod & go.sum

2020-11-01 Thread Miki Tebeka
I *do* use "go test", see https://github.com/tebeka/recheck/blob/master/regression_test.go On Sunday, November 1, 2020 at 8:43:33 AM UTC+2 amits...@gmail.com wrote: > > > On Sun, 1 Nov 2020, 4:07 pm Miki Tebeka, wrote: > >> Hi, >> >> I wrote a regexp l

[go-nuts] Running "go test" modifies go.mod & go.sum

2020-10-31 Thread Miki Tebeka
Hi, I wrote a regexp linter (https://github.com/tebeka/recheck) that's using golang.org/x/tools/go/analysis. To test the tool, I run "go run ./cmd/recheck testdata/ok.go" (using os/exec). The problem is that after the test, go.mod & go.sum are modified since there are some external imports

Re: [go-nuts] Dynamic include path in cgo?

2020-08-09 Thread Miki Tebeka
n Lance Taylor wrote: > > On Sun, Aug 9, 2020 at 9:57 AM Miki Tebeka > wrote: > > > > Is there a way to pass include path dynamically to cgo? > > > > I'm working with numpy and the way to find the include directory is to > call (in Python) > >

[go-nuts] Dynamic include path in cgo?

2020-08-09 Thread Miki Tebeka
Is there a way to pass include path dynamically to cgo? I'm working with numpy and the way to find the include directory is to call (in Python) numpy.get_include() In a Makefile I can run go build with CGO_CFLAGS=-I $(shell python -c 'import numpy; print(numpy.get_include())') go build

Re: [go-nuts] Is there +v Stringer interface?

2020-06-24 Thread Miki Tebeka
On Thursday, June 25, 2020 at 2:41:01 AM UTC+3, Ian Davis wrote: > > fmt.Formatter is woefully under documented. > My reference is pkg/errros - https://github.com/pkg/errors/blob/master/errors.go#L127 -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] Question about strings.EqualFold vs Python's casefold

2020-05-01 Thread Miki Tebeka
Thanks! On Friday, May 1, 2020 at 8:21:48 AM UTC+3, Ian Lance Taylor wrote: > > On Thu, Apr 30, 2020 at 9:42 PM Miki Tebeka > wrote: > > > > I'm trying to find an example where strings.EqualFold returns true but > comparison of strings.ToLower fails. > > I've

[go-nuts] Question about strings.EqualFold vs Python's casefold

2020-04-30 Thread Miki Tebeka
Hi, I'm trying to find an example where strings.EqualFold returns true but comparison of strings.ToLower fails. I've found this example (in Python): s1 = "der Fluß" s2 = "der Fluss" print('lower', s1.lower() ==

[go-nuts] Re: cgo can't find .so in same directory

2020-04-30 Thread Miki Tebeka
IMO the #cgo directive is just building the executable, not for running it. You can set the LD_LIBRARY_PATH environment variable before running the exeutable LD_LIBRARY_PATH=${PWD} ./app On Thursday, April 30, 2020 at 7:19:36 AM UTC+3, Dean Schulze wrote: > > I'm following a simple example >

[go-nuts] Re: [ANN] Go Brain Teasers (book)

2020-04-18 Thread Miki Tebeka
> give us a few samples to whet our appetite! > Sure (as long as 1 counts as "few" :) https://www.353solutions.com/go-brain-teasers -- 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

[go-nuts] [ANN] Go Brain Teasers (book)

2020-04-18 Thread Miki Tebeka
Hi, I'm happy to announce that my book is finally out. It contains 25 brain teasers to tickle your mind. - Gumroad (ePub & PDF) https://gum.co/Qkmou - Amazon (mobi & dead tree) https://www.amazon.com/dp/B0876DBMFM/ Speical thanks to Dave Cheney for writing the foward and inspiring some of

[go-nuts] Re: Go course

2020-03-27 Thread Miki Tebeka
I'm curious if you find https://www.353solutions.com/annotated-go helpful? On Wednesday, March 25, 2020 at 6:57:23 PM UTC+2, Renato Marcandier wrote: > > Hello guys, > > What's the best course to start with Go? > > > > Regards > RG > -- You received this message because you are subscribed to

[go-nuts] Re: Docker Server access Failed

2020-03-22 Thread Miki Tebeka
Hi, But when I had try to open my test website ON MY BROWSER "unable to > connect" > You probably need to export the docker port to the host OS (your computer). See https://docs.docker.com/engine/reference/run/#expose-incoming-ports HTH, Miki -- You received this message because you

[go-nuts] GopherCon Israel - Call for Papers & Free tickets

2019-11-18 Thread Miki Tebeka
Hello Gophers, We’re getting great submission to the GopherCon Israel CFP. However, we'd like to have more. We’ll raffle three FREE tickets to the conference among anyone who submitted a talk. Also, everyone who submitted will be invited to a talk on that will help them improve as speakers.

[go-nuts] Re: trace tool showing goroutines moving between procs after LockOSThread

2019-10-22 Thread Miki Tebeka
or more detail. https://golang.org/src/runtime/proc.go > > Hope that helps, > Chris > > On Sunday, October 6, 2019 at 7:47:43 AM UTC-4, Miki Tebeka wrote: >> >> Hi, >> >> I'm trying to understand output of the "go tool trace". I'm using >>

[go-nuts] trace tool showing goroutines moving between procs after LockOSThread

2019-10-06 Thread Miki Tebeka
Hi, I'm trying to understand output of the "go tool trace". I'm using runtime.LockOSThread, however the output of the trace tool shows goroutines moving between procs (which I *think* are OS threads). What am I missing? Code: package main import ( "fmt" "os" "runtime" "runtime/trace" "time" )

Re: [go-nuts] Re: Golang project ideas

2019-08-25 Thread Miki Tebeka
Thanks, I'll do some code & issues cleanup and let you know. On Thursday, August 22, 2019 at 5:57:26 PM UTC+3, satyendra singh wrote: > > Hi Miki, > I am also new to go working from about 16 weeks. > I would like to help on your project > > On Thu, 22 Aug 2019 at 14:03

[go-nuts] Re: Golang project ideas

2019-08-22 Thread Miki Tebeka
If you're interested. I'm looking for help in https://github.com/tebeka/go2xunit/ and willing to mentor. Doing a big refactoring there so it's a good opportunity. On Friday, August 16, 2019 at 3:24:28 AM UTC+3, kife...@gmail.com wrote: > > I'm new to go, been working with go for about ten

[go-nuts] How to make a package with cgo "go gettable"

2019-07-14 Thread Miki Tebeka
Hi, I have a packge with cgo that require some external headers & libraries to build (Apache arrow). What's the best practice for making this packge easy to "go get"? To make things more interesting, Arrow is a C++ library. Currently I build a static library and link with it, however it's very

[go-nuts] Re: how to test main function coverage with different args

2019-04-24 Thread Miki Tebeka
You can use table driven test, see https://github.com/golang/go/wiki/TableDrivenTests On Tuesday, April 23, 2019 at 12:03:15 PM UTC+3, hui zhang wrote: > > how to test main function coverage with different args to enhance > coverage rate > how to cover the red part ? for you can set args once

[go-nuts] Re: how to go test a daemon process

2019-04-23 Thread Miki Tebeka
You can run main in a goroutine, sleep for some time (or stress test the server) and then exit. On Tuesday, April 23, 2019 at 11:25:49 AM UTC+3, hui zhang wrote: > > I have daemon process, I try to test its coverage > > > func Test_main(m *testing.T) { >main() > } > > go test -coverprofile

[go-nuts] Re: Does anyone know how to implement dynamic two-dimensional arrays ??

2019-04-21 Thread Miki Tebeka
Apart from writing your own, you might want to take a look at gonum - https://godoc.org/gonum.org/v1/gonum/mat On Sunday, April 21, 2019 at 8:10:40 AM UTC+3, lgo...@gmail.com wrote: > > Here's the snippet I'm trying to run > > package main > import ( "fmt" ) > > func main() { > Af(5) > } > >

Re: [go-nuts] floating point question

2019-04-16 Thread Miki Tebeka
I came across this when teaching about floats not being exact, was surprised to see the "true" :) On Monday, April 15, 2019 at 7:59:28 PM UTC+3, David Riley wrote: > > On Apr 15, 2019, at 12:47 PM, Miki Tebeka > wrote: > > > > On Monday, April 15, 2019 at 2:

Re: [go-nuts] floating point question

2019-04-16 Thread Miki Tebeka
Thanks! On Monday, April 15, 2019 at 7:51:05 PM UTC+3, Jan Mercl wrote: > > > > On Mon, Apr 15, 2019 at 6:47 PM Miki Tebeka > wrote: > > > Does that mean that the Go compiler is using floats with more precision > than the runtime? > > Absolutely: http

Re: [go-nuts] floating point question

2019-04-15 Thread Miki Tebeka
On Monday, April 15, 2019 at 2:12:18 PM UTC+3, Jan Mercl wrote: 1.1*1.1 and 1.21 are untyped constants and have much higher precision at > which they are not equal. > Does that mean that the Go compiler is using floats with more precision than the runtime? -- You received this message

[go-nuts] floating point question

2019-04-15 Thread Miki Tebeka
Hi, Can anyone explain the below? (When printing out b with %.20f it prints 1.20996447) Thanks package main import "fmt" func main() { a, b := 1.1*1.1, 1.21 fmt.Println(a == b) // true fmt.Println(1.1*1.1 == 1.21) // false } -- You received this message because you

Re: [go-nuts] Go vs C speed - What am I doing wrong?

2019-02-03 Thread Miki Tebeka
even 1.5 sounds like a lot, as soon as you do any IO > that will fall to about .001 percent difference. > > On Feb 3, 2019, at 12:49 PM, Miki Tebeka > > wrote: > > Yup. Using int32 in Go reduces the difference to 1.5. Thanks > > On Sunday, February 3, 2019 at 8:

Re: [go-nuts] Go vs C speed - What am I doing wrong?

2019-02-03 Thread Miki Tebeka
; wrote: > > Don’t use rtdsc in the C program use gettimeofday to ensure you are > comparing the same. > > On Feb 3, 2019, at 12:22 PM, Miki Tebeka > > wrote: > > Hi, > > I'm comparing two loops in Go and C. The Go code on my machine is about 3 > times slower

[go-nuts] Re: Go vs C speed - What am I doing wrong?

2019-02-03 Thread Miki Tebeka
. 13: } . . 14: return sum . . 15:} On Sunday, February 3, 2019 at 8:22:54 PM UTC+2, Miki Tebeka wrote: > > Hi, > > I'm comparing two loops in Go and C. The Go code on my machine is about 3 > times slower than C. I know C can be f

[go-nuts] Go vs C speed - What am I doing wrong?

2019-02-03 Thread Miki Tebeka
Hi, I'm comparing two loops in Go and C. The Go code on my machine is about 3 times slower than C. I know C can be faster but didn't think it'll be that faster. Any ideas what's making the Go code slower? You can see the code at https://github.com/tebeka/go-c-loop Go Code: package main

[go-nuts] [ANN] GopherCon Israel Call for Papers is Open

2018-10-31 Thread Miki Tebeka
Hello Gophers, GopherCon Israel CFP is open. Head over to https://www.papercall.io/cfps/1422/submissions/new and submit your talk. If you're not sure, ping me and I'll convince you to submit :) Please help us spread the word. - https://www.gophercon.org.il/ -

[go-nuts] Re: CGO - convert a c.char array to string

2018-08-05 Thread Miki Tebeka
Hi, > i have a little problem to convert a C char array to a string array in > golang > Maybe something like var offset = unsafe.Sizeof(uintptr(0)) func argv2go(argv **C.char) []string { var out []string for *argv != nil { out = append(out, C.GoString(*argv)) argv =

[go-nuts] Streaming (chunked HTTP) to fasthttp.RequestCtx

2018-08-05 Thread Miki Tebeka
Hi, Since I didn't get an answer on SO , though I'll try here :) I'd like to let client do streaming API and using fasthttp as the backend. I don't want to expose the `fasthttp.RequestCtx` to the client and don't

[go-nuts] ANN: Go Israel May Meetup

2018-04-09 Thread Miki Tebeka
Hi All, The Go Israel next meetup will be help on May 2, 2018. Agenda - gRPC by Almog Baku - Embedding other Languages in Go (http://nuclio.io framework) by Miki Tebeka See more at https://www.meetup.com/Go-Israel/events/kjvczlyxhbdb/ See you there, -- Miki -- You received this message

[go-nuts] [ANN] Go Israel Meetup - Thu, March 8, 2018

2018-02-26 Thread Miki Tebeka
Hi, If you're around and interested, our next Go Israel meetup on on Thu, March 8, 2018. 6pm at Google campus Tel Aviv. We'll have two talks: - From zero to access token by Roy Segall - gRPC by Almog Baku See more at https://www.meetup.com/Go-Israel/events/kjvczlyxfbkb/ See you there, -- Miki

[go-nuts] Re: Selenium webdriver based testing in Go

2018-01-02 Thread Miki Tebeka
Original author of github.com/tebeka/selenium here. Currently maintained by the awesome Eric Garrido and IMO actively used inside Google for testing. I mostly wrote tests in Go, not using the IDE. On Monday, January 1, 2018 at 12:55:39 AM UTC+2, Tong Sun wrote: > > Hi, > > Anyone here ever

[go-nuts] Re: pkg-config sqlite3, Go sqlite3 code stop working after Go upgrade

2017-12-16 Thread Miki Tebeka
For some reason pkg-config doesn't know about sqlite3. It can be that sqlite3 is not installed (or not installed properly). pkg-config looks for sqlite3.pc in some pre-defined libraries (/usr/share/pkgconfig /usr/lib/pkgconfig ...) and as the error message says - you can added other

[go-nuts] Re: python remote objects

2017-12-14 Thread Miki Tebeka
Are you talking about https://pythonhosted.org/Pyro4/ ? It really depends on the serialization format used. If it's json, msgpack or any other language independent format that you can do it. If it's Python specific (marshal, pickle, ...) then you can probably invoke some python code to convert

[go-nuts] Re: Mapping C pointer to BYTE to golang []byte

2017-12-14 Thread Miki Tebeka
Do you mean func C.GoBytes(unsafe.Pointer, C.int) []byte ? On Thursday, December 14, 2017 at 9:05:32 AM UTC+2, snmed wrote: > > Hi all > > I'm trying to map a C structure to an equivalent go struct, but I bumped > into a problem with a pointer to byte that is actually an array of bytes. > >

[go-nuts] Re: For loop in go templating

2017-12-11 Thread Miki Tebeka
You can probably organize the data a bit before sending it to the template and use "range". Something similar to https://play.golang.org/p/us5ABFoaeB On Tuesday, December 12, 2017 at 6:43:06 AM UTC+2, Josh Cox wrote: > > Why is there not a 'for' action in go templating >

[go-nuts] Re: Python ⇒ Go Cheatsheet

2017-11-26 Thread Miki Tebeka
Thanks! I do show sort.Strings there (first one). On Saturday, November 25, 2017 at 1:31:31 PM UTC+2, Stefan Nilsson wrote: > > Very nice! > > Just one comment: you may want to use sort.Strings instead in the sorting > example. > > On Saturday, November 25, 2017 at 9:39:56

[go-nuts] Python ⇒ Go Cheatsheet

2017-11-25 Thread Miki Tebeka
Hi, To help Python people switching to Go I've created a cheatsheet - https://www.353.solutions/py2go/index.html Hope you'll find it useful, comment and bug reports are welcomed - https://github.com/tebeka/py2go-cheatsheet Happy Hacking, -- Miki -- You received this message because you are

[go-nuts] [ANN] Go-Israel November 9 Meetup at Google Campus

2017-10-24 Thread Miki Tebeka
Hello, Go-Israel next meetup will happen on November 9 at the Google Campus in Tel Aviv. We have two great talks: - Eran Duchan - What makes nuclio (https://github.com/nuclio/nuclio) the fastest serverless framework, and why we needed to write it in the first place - Sergey Lanzman -

[go-nuts] Re: Debugging error: plugin.Open: plugin was built with a different version of package

2017-10-23 Thread Miki Tebeka
This happened to me as well when using vendored dependencies. Is this your case? If so move the dependencies to GOPATH On Thursday, October 19, 2017 at 5:37:53 PM UTC+3, voidlogic wrote: > > Hey Everyone, > > Does anyone know how to debug "*plugin.Open: plugin was built with a > different

[go-nuts] [ANN] Learn Go by Writing REST APIs - Free Workshop (Tel Aviv)

2017-09-17 Thread Miki Tebeka
Hi, We'll be doing an introductory "hands on" workshop for people who are interested in learning Go. We'll learn go by writing a REST API server. Limited availability, register at https://www.eventbrite.com/e/learn-go-by-writing-rest-apis-tickets-37870497678 Happy hacking, -- Miki -- You

[go-nuts] Re: Best way to launch/monitor several go process in production

2017-09-04 Thread Miki Tebeka
I've used http://supervisord.org/ in the past, very easy to set up and you can get notified when a process exits. On Monday, September 4, 2017 at 12:35:30 AM UTC+3, emarti...@gmail.com wrote: > > Hello, > > I am looking for the 'best' way to launch and monitor several go > processes. Doing it

Re: [go-nuts] Question about plugins & types

2017-09-04 Thread Miki Tebeka
ld just forego the MathFunc type altogether and just use > func(int, int) int in your code. > > FWIW, the reason http has HandlerFunc, is mainly to add a method > <http://godoc.org/net/http#HandlerFunc.ServeHTTP> to it to make it an > http.Handler <https://godoc.org/

[go-nuts] Question about plugins & types

2017-09-03 Thread Miki Tebeka
Hi, Assume I have a plugin: package main func Add(x, y int) int { return x + y } func main() {} I'd like to make sure that plugin functions are from certain type. So I wrote (ignore panics, they are for brevity): Enter code here...package main import ( "fmt" "plugin" ) type MathFunc

[go-nuts] Re: Tell "dep" to ignore a dependency?

2017-08-06 Thread Miki Tebeka
Wasn't aware this is possible, will do - thanks. On Sunday, August 6, 2017 at 4:53:13 PM UTC+3, Paul Tötterman wrote: > > Thanks. But if I'll use constraint I'll need to rewrite all the import >> paths in my code (and maybe in the vendor directory as well) >> > > Maybe I've misunderstood

[go-nuts] Tell "dep" to ignore a dependency?

2017-08-06 Thread Miki Tebeka
Hi, I plan to use "dep" and also to place "vendor" in the git repository. However I have one dependency in vendor which is locally patched. The problem for me is that "dep ensure" overwrites my patch every time. Is there a way to tell "dep" to ignore this specific package? (There are

[go-nuts] Re: "Selling" Go to Management

2017-05-04 Thread Miki Tebeka
Thanks to all who replied! On Sunday, April 30, 2017 at 11:13:52 AM UTC+3, Miki Tebeka wrote: > > And of course the community :) > > On Sunday, April 30, 2017 at 10:41:14 AM UTC+3, Miki Tebeka wrote: >> >> Hi, >> >> I'm giving a 1 hour talk on G

[go-nuts] Re: "Selling" Go to Management

2017-04-30 Thread Miki Tebeka
And of course the community :) On Sunday, April 30, 2017 at 10:41:14 AM UTC+3, Miki Tebeka wrote: > > Hi, > > I'm giving a 1 hour talk on Go to mid/high level management. Here are the > points I thought to bring up (not in order), I'd appreciate any > comments/ideas. &g

[go-nuts] "Selling" Go to Management

2017-04-30 Thread Miki Tebeka
Hi, I'm giving a 1 hour talk on Go to mid/high level management. Here are the points I thought to bring up (not in order), I'd appreciate any comments/ideas. * The free lunch is over - threads/async are difficult to work with * Small language - Easy to learn * Simple C based syntax

[go-nuts] Re: How do I test an func which depends on (pseudo)-random numbers, e.g. rand.Intn()?

2017-03-14 Thread Miki Tebeka
IMO the right approach is as you suggested - seed once in init. init is called before your tests, so the seed you do in your test will override it. On Wednesday, March 15, 2017 at 5:45:22 AM UTC+2, Doug Ireton wrote: > > I'm a new Gopher and I'm working through "Learn Go" by Nathan Youngman >

[go-nuts] Re: “invalid memory address” when calling Go from Python/C

2017-03-09 Thread Miki Tebeka
On Thursday, March 9, 2017 at 5:00:45 PM UTC+2, Miki Tebeka wrote: > > Hi There, > > (Originally posted on StackOverflow > <http://stackoverflow.com/questions/42689133/invalid-memory-address-when-calling-go-from-python>, > > trying my luck here as well). > &

Re: [go-nuts] “invalid memory address” when calling Go from Python/C

2017-03-09 Thread Miki Tebeka
Thanks. Changing the error to a string worked. I'm trying to see how can I quickly reuse Go code from Python without too much wrapping. Seems like I can get get away with it :) On Thursday, March 9, 2017 at 9:45:30 PM UTC+2, Ian Lance Taylor wrote: > > On Thu, Mar 9, 2017 at 7:00 AM

[go-nuts] “invalid memory address” when calling Go from Python/C

2017-03-09 Thread Miki Tebeka
Hi There, (Originally posted on StackOverflow , trying my luck here as well). I'm trying to extend the code in Calling Go Functions from Other Languages. I'd like see how a function returning an

[go-nuts] [ANN] selenium - Change of ownership

2016-12-09 Thread Miki Tebeka
Hi All, I'm glad to say that Eric Garrido has taken ownership on the Selenium bindings. To avoid unnecessary downstream churn the code will still be under https://github.com/tebeka/selenium but Eric has the final word on everything. I'm sure Eric will do great things with Selenium and will