Re: [go-nuts] Re: prevent alteration of binaries once distributed in the wild?

2019-07-23 Thread Marcin Romaszewicz
Don't be too afraid of governments tampering with your program, I mean this in the best possible way, but you are nobody important enough :) Governments issue subpoenas, arrest warrants, and issue court orders - that's much quicker and more effective than hacking. In the security space, we also

Re: [go-nuts] Re: About the Google logo on the new Go website

2019-07-15 Thread Marcin Romaszewicz
I used to work at Google at the time that Go was created, and these are my own observations. Google isn't making zillions off Go. Google makes zillions off advertising and is trying to make money other ways, but not always very successfully. Go really was designed as a nice to use systems language

Re: [go-nuts] Some thoughts on query building in Go

2019-07-13 Thread Marcin Romaszewicz
I think that query builders are nice to have and proofs of concept are simple for simple queries, but the moment you need to leave the simple query domain and do something a little more complicated, things start to fall apart. As an example, say you want to store a struct in a database which

Re: Re: [go-nuts] How go-mysql-driver get data? "get all data at a time" or "only get a batch when we call rows.Next"?

2019-06-26 Thread Marcin Romaszewicz
No, it doesn't get all the data in the Next() call, it streams it incrementally from the DB. I've used it to stream gigabytes before, and they certainly didn't get buffered in RAM. On Wed, Jun 26, 2019 at 11:04 AM wrote: > Get all data in the first Next() call? or only get a batch? > >

Re: [go-nuts] sudo ./main command throwing error

2019-06-24 Thread Marcin Romaszewicz
sudo does not preserve environment variables for security reasons, run: sudo echo $LD_LIBRARY_PATH You'll likely see that it's empty, unless you have a global system one set. On Mon, Jun 24, 2019 at 9:48 AM Nitish Saboo wrote: > Hi , > > I am using cgo in this project where I need the

Re: [go-nuts] Concerning the level required to contribute to Go

2019-06-21 Thread Marcin Romaszewicz
So, I'm not a Go contributor, but I've been doing this software-for-a-living thing for about 25 years now, but never in these years have I experience some kind of read/not ready transition. When I was less experienced, I thought I knew a lot more than I did, now that I know an order of magnitude

Re: [go-nuts] Re: Go will shine on huge web projects, but how about simple ones?

2019-06-10 Thread Marcin Romaszewicz
0.8 4 11 Percentage of the requests served within a certain time (ms) 50% 4 66% 4 75% 5 80% 5 90% 5 95% 5 98% 6 99% 6 100% 11 (longest request) On Mon, Jun 10, 2019 at 4:12 PM Marcin Romaszewicz wrote: > One more followu

Re: [go-nuts] Re: Go will shine on huge web projects, but how about simple ones?

2019-06-10 Thread Marcin Romaszewicz
response.Header().Add("Connection", "close") response.Header().Add("ETag", "dbab") response.Header().Add("Cache-Control", "public, max-age=31536000") response.Header().Add("Content-length", strconv.Itoa(len(pixelBu

Re: [go-nuts] Re: Go will shine on huge web projects, but how about simple ones?

2019-06-10 Thread Marcin Romaszewicz
I think the others were correct in pointing the finger at the RegEx engine in Go. It is quite slow. I hacked your inside loop which checks the request not to use regular expressions, and it's tons faster. You can't say that something can't be responsible for too much slowdown because it "1 line",

Re: [go-nuts] There are post-quantum public key cryptograph in Go ? or binds to Go? Thanks.

2019-06-08 Thread Marcin Romaszewicz
The NIST publishes some recommendations for applied cryptography, and they've amended their recommendations recently away from some quantum-weak algorithms. Here's a good starting point for reading. Your biggest cryptography

Re: [go-nuts] How do you keep your modules up-to-date?

2019-05-30 Thread Marcin Romaszewicz
I have the same kind of setup at my company, and we use go modules in the same way that we would use public modules. We periodically do a "go get -u" to update them. Jenkins does that once a week, so at worst, we're a week behind. If someone needs to manually pull in changes more urgently, they

Re: [go-nuts] Getting type information from name as a string

2019-05-21 Thread Marcin Romaszewicz
That's what the reflect package does, https://play.golang.org/p/M7gNcKjOmMM -- Marcin On Tue, May 21, 2019 at 8:15 PM wrote: > Hi, > > for a code generator I want to get a type of a string which is passed by > an argument by go generate. So I have sth. like "[]int" and now I need to > know if

Re: [go-nuts] Install Lastest Modules

2019-05-14 Thread Marcin Romaszewicz
go get -u github.com/360EntSecGroup-Skylar/excelize/v2 will do what you want. You then have to import " github.com/360EntSecGroup-Skylar/excelize/v2" in all your Go files. -- Marcin On Tue, May 14, 2019 at 3:37 PM Andrew wrote: > I want to install the latest version(v2.0.0) of excelize library

Re: [go-nuts] Re: Web access to golang-dev is down

2019-05-07 Thread Marcin Romaszewicz
The same for me. golang-dev is not accessible to me, nor does it show up in a group search, meaning it's not visible to me. I'm not a registered member of it, so it appears to no longer be a public group. -- Marcin On Tue, May 7, 2019 at 7:57 AM wrote: > Sorry, forgot to include: Yes, I can

Re: [go-nuts] request for feedback on this channel based waitgroup

2019-05-05 Thread Marcin Romaszewicz
I've done quite a bit of MP programming over 20+ years now, and skimming your code, I see a number of issues. There are probably a lot more that I don't. In the latest go playground link Line14: if "if wg.started {" has a race condition, both on accessing the variable, and logically, in that two

Re: [go-nuts] Go-SQLite3: Convert between string and slice

2019-05-05 Thread Marcin Romaszewicz
Define a type: type Countries []Country Then, for that type, implement the sql.Scanner and sql.Valuer interfaces. You could, for example, marshal your state array as a list of comma separated states. You're not casting, but providing customer scanners/readers for your data type which convert it

Re: [go-nuts] Re: What does "identifier...type" mean in a function definition?

2019-05-03 Thread Marcin Romaszewicz
Consider this: var something []interface{} var anotherThing []SomeType append(something, anotherThing) Does the compiler know here whether I want to append "anotherThing" or " anotherThing..."? It has no way to know, and both would work, so that's why we give it a hint with the ellipsis symbol.

Re: [go-nuts] Random panic in production with Sprintf

2019-05-02 Thread Marcin Romaszewicz
If that's the actual problem, you'd just be masking it, and producing an invalid "x". Look here: func (r *Subid_info) Prepare_subid_logic(){ r.Second_subid_8=fmt.Sprintf("1%07v", r.Second_subid) > panic happens here. } r.Second_subid is in an invalid state which normal Go code could not

Re: [go-nuts] Re: Get fingerprint of ca

2019-04-30 Thread Marcin Romaszewicz
the chain is up to you. Have a look here as starting points. https://ericchiang.github.io/post/go-tls/ https://security.stackexchange.com/questions/130847/how-tls-certificate-chain-is-verified On Tue, Apr 30, 2019 at 1:12 PM Vasiliy Tolstov wrote: > вт, 30 апр. 2019 г. в 23:01, Mar

Re: [go-nuts] Re: Get fingerprint of ca

2019-04-30 Thread Marcin Romaszewicz
Look at the ""crypto/x509" package, specifically at CertPool. You would load your CA public cert and intermediate cert's into a CertPool. Once you have a CertPool, you can use it in tls.Config to configure your TLS connections. Given a valid certificate chain, Go will automatically validate

[go-nuts] Releasing an open source client/server generator for Swagger

2019-04-26 Thread Marcin Romaszewicz
Hi All, These days, spec-driven development of REST API's is quite common, and I've had to reinvent this wheel more than once, so my gracious employer has allowed me to open source my work. https://github.com/deepmap/oapi-codegen This is like protocol buffer specifications for JSON/REST. You

Re: [go-nuts] What does "identifier...type" mean in a function definition?

2019-04-25 Thread Marcin Romaszewicz
You have three tokens in "args ... interface{}", (args) (...) (interface{}), the spacing doesn't matter in this case. It's just like in C, you can have int *foo or int* foo. Semantically, the two are the same. -- Marcin On Thu, Apr 25, 2019 at 12:35 PM Andrew Price wrote: > Hey folks, > > A

Re: [go-nuts] go build *.exe file size seems much too large

2019-04-21 Thread Marcin Romaszewicz
It contains the Go runtime - memory manager, goroutine scheduler, all that. -- Marcin On Sun, Apr 21, 2019 at 7:16 PM wrote: > For this simple go code, the *.exe file size is 1800 KB ...why so large > compared to equivalent C-compiled code ?? > package main > import( "math"; "fmt" ) > func

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

2019-04-20 Thread Marcin Romaszewicz
I fixed your example with some explanatory comments: https://play.golang.org/p/zwt78CPwxk_o package main import ( "fmt" ) func main() { Af(5) } func Af ( N int) { //Initialize outer array, you get an array of 25 nil arrays M := make( [][]uint16, N*N,N*N) for y:=0; y< N; y++ { //

Re: [go-nuts] What is recommended way to initialize and keep prepared statements in go Lang

2019-04-14 Thread Marcin Romaszewicz
e prepare statements this struct will keep on > increasing so my question was is there any better way provided in golang > like in java (where we can initialize prepare statement in class > constructor and use that ) > > On Sun, Apr 14, 2019 at 7:59 AM Marcin Romaszewicz > wrote: > >> D

Re: [go-nuts] What is recommended way to initialize and keep prepared statements in go Lang

2019-04-13 Thread Marcin Romaszewicz
Do you mean a SQL prepared statement? Check out the database/sql package. The database connection abstraction has a Prepare function which creates a statement. Keep in mind, that based on your level of concurrency, the statement will be re-prepared in each new connection that's opened up on your

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

Re: [go-nuts] why is this not ascending?

2019-04-08 Thread Marcin Romaszewicz
I added this at the top of your main "fmt.Println("CPU Count", runtime.NumCPU())", and found out that the playground uses 1 CPU, so your goroutines will not run concurrently. The scheduler will do a context switch whenever you call a any number of runtime functions, but it is fundamentally

Re: [go-nuts] Re: Decimal survey

2019-03-28 Thread Marcin Romaszewicz
A huge +1 on that last comment. You never want to store currency in floating point, but rather some form of fixed point notation, like your pennies suggestion. Compounding errors on floating point representations of currency kill you. For example, $0.01 is not exactly representable as float. How

Re: [go-nuts] [ANN] GoLand 2019.1 is out

2019-03-27 Thread Marcin Romaszewicz
Thank you! You guys build a fantastic IDE. -- Marcin On Wed, Mar 27, 2019 at 8:59 AM Florin Pățan wrote: > Hello gophers, > > > I'm happy to let you know that we just released GoLand 2019.1. > > Here are a few things you can find in this release: > >- Built-in Profiler support for CPU,

Re: [go-nuts] Go Need help _ suddenly all teh unit test in Go Stopped working

2019-03-25 Thread Marcin Romaszewicz
Go is telling you what is wrong in that message. You have a file `C:\Users\Gini Joseph\GoWorkspace\pkg\mod\github.com \stretchr\testify@v1.3.0\mock\mock_test.go` which does not have the expected "package" line at the top of the file, because the file is empty (EOF = end of file). So, as a first

Re: [go-nuts] I am starting Golang and I am looking for a example to Login, Logout, Signup..

2019-03-19 Thread Marcin Romaszewicz
I build these kinds of things for a living, and sadly, there isn't very much in pure Go that I'm aware of to do this. I have a bunch of Go code which I use to do this, but sadly, I can't share it yet, as I'm working on getting approval to open source it. The quickest way might be to put a SAML or

Re: [go-nuts] Persistence of value, or Safely close what you expected

2019-03-13 Thread Marcin Romaszewicz
Your program is most certainly non-deterministic, and you will sometimes close a closed channel and panic. There is no thread safe way to test if a channel is closed, then close it if it isn't. I think of channel ownership in a similar way as of memory ownership in C/C++. If this channel is being

Re: [go-nuts] regarding os package & env variable setting

2019-03-05 Thread Marcin Romaszewicz
os.Setenv only changes the environment variables in your process and in any future child processes. It's not actually possible to change the environment of your parent process or the OS through this mechanism. -- Marcin On Tue, Mar 5, 2019 at 6:00 AM wrote: > Hi, > I am trying to enable tls

Re: [go-nuts] Allow go mod download to store in subdirectory of current working directory

2019-03-04 Thread Marcin Romaszewicz
Can you accomplish what you want with module vendoring? Before I set up my own Athens proxy, I was using that to avoid DDOSing github in my build automation, and it seemed to work fine. Your first pipeline step could vendor in all the modules, and subsequent pipeline steps would use those. --

<    1   2