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

2019-04-23 Thread hui zhang


I have daemon process,  I try to test its coverage


func Test_main(m *testing.T) {
   main()
}

go test -coverprofile coverage.out -args xxx.conf

since it is a daemon,  I have to kill it to stop it
kill   or   ctrl  +  c


I got the coverage report  coverage.out  only 10B


and of course ,  no  coverage report when run 

go tool cover -html=coverage.out -o coverage.html



how to solve this problem?

-- 
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: 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 coverage.out -args xxx.conf
>
> since it is a daemon,  I have to kill it to stop it
> kill   or   ctrl  +  c
>
>
> I got the coverage report  coverage.out  only 10B
>
>
> and of course ,  no  coverage report when run 
>
> go tool cover -html=coverage.out -o coverage.html
>
>
>
> how to solve this problem?
>
>

-- 
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] how to test main function coverage with different args

2019-04-23 Thread hui zhang
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 a time

func Test_main(m *testing.T) {
   main2()
}


go test -coverprofile coverage.cov -args xxx.conf go tool cover 
-html=coverage.cov -o coverage.html

-- 
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+ replacement

2019-04-23 Thread Mandolyte
I think MeWe could do the job in a functional sense - but there is no 
reason for Go folks to go there in mass. I find that Reddit has most of the 
same links to info that G+ did... so I'm ok with it. I have accounts on 
both MeWe and Reddit already for other things... so yeah...

On Sunday, April 21, 2019 at 9:13:22 PM UTC-4, icod...@gmail.com wrote:
>
> I don't know about you but for me, even if there wasn't so much going on, 
> Google+ and the Go+ community was a source of info.
>
> Reddit is reddit, this whatever it is, is what it is, mewe can't 
> replace G+.
> Facebook just isn't the crowd.
> Xing and the like just aren't made to handle the task of staying informed 
> and people presenting their work.
>
> An essential source of information has disappeared.
> What is there to replace it?
>
> People would post links to youtube videos there, some were quite 
> interesting and some were fresh from the horses mouth about whatever 
> conferences or happenings.
> It's all gone now.
>
> Nuts is more of a "help I have a problem" thing.
>
> I know, Google+ had its own issues, the biggest was them forcing changes 
> onto their users no one wanted.
> As a result most people stopped using it and in the end it disappeared.
>
> G+ did fill a nieche, that of the enterpreteur who also wanted to be 
> entertained and catch news, stay up to date.
>
> I know this post is kind of pointless, since it won't change what is.
> But maybe something exists that I'm unaware of
>

-- 
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] ?? Does anyone know of a good on-line doc that describes how Go Garbage Collection works .. My recent web searches proved fruitless

2019-04-23 Thread lgodio2
all responses appreciated 

-- 
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] Go+ replacement

2019-04-23 Thread David Riley
On Apr 21, 2019, at 9:02 PM, icod.d...@gmail.com wrote:
> 
> I don't know about you but for me, even if there wasn't so much going on, 
> Google+ and the Go+ community was a source of info.
> 
> Reddit is reddit, this whatever it is, is what it is, mewe can't replace 
> G+.
> Facebook just isn't the crowd.
> Xing and the like just aren't made to handle the task of staying informed and 
> people presenting their work.
> 
> An essential source of information has disappeared.
> What is there to replace it?
> 
> People would post links to youtube videos there, some were quite interesting 
> and some were fresh from the horses mouth about whatever conferences or 
> happenings.
> It's all gone now.
> 
> Nuts is more of a "help I have a problem" thing.
> 
> I know, Google+ had its own issues, the biggest was them forcing changes onto 
> their users no one wanted.
> As a result most people stopped using it and in the end it disappeared.
> 
> G+ did fill a nieche, that of the enterpreteur who also wanted to be 
> entertained and catch news, stay up to date.
> 
> I know this post is kind of pointless, since it won't change what is.
> But maybe something exists that I'm unaware of

I actually find that the Go community on Twitter fills a lot of those roles for 
me fairly well.


- Dave

-- 
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: built-in alternative to bcrypt?

2019-04-23 Thread whitehexagon via golang-nuts
Don't get me wrong, I strongly believe in storing user data safely, and 
especially passwords, hence my original question.  But as I mentioned, I'm 
basically trying to protect a customers email address at this point.  So if 
the attack vector I'm defending against is someone having direct access to 
the DB, whether physical or dumped.  Then they already have the email 
addresses I'm trying to protect.  So I'm paying to protect a password that 
will be superfluous. 

I do hear the message to plan ahead, but looking at bcrypt, it seems like I 
could scale the cost factor as and when data becomes more valuable, or when 
it becomes a killer app ;) It even has a method there to determine the cost 
from the previous hash which seems designed for that task?  Since I'm 
guessing it's not been added to help determine brute force efforts :) and 
now that I know the 'x' stuff is internally developed I feel more 
comfortable using it.

In the case of client side hashing, I'm worried about clear text passwords 
ending up in log files or some such, as just happened with fb last week.  
Since I have no control over the data between the clients, and the hosted 
execution environment.  This may possibly be the weakest link, or a debug 
statement left in code that accidentally does the same...

Thanks all for your feedback,
Peter

-- 
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] Go+ replacement

2019-04-23 Thread Darko Luketic
But Twitter is a loose group of individuals, or does it have group 
functionality now? Everything is done via #channels last time I checked.
I honestly very rarely use it, too small sized posts, it's very chaotic and 
stuff you've seen just now is gone after a reload and can't be found again.
Also it's always so political and full of journalists, so hipster, all show 
no substance.
Anyhow what channels or "hashtags" do you subscribe to, or can you even 
subscribe to hashtags?

On Tuesday, April 23, 2019 at 4:52:14 PM UTC+2, David Riley wrote:
>
> On Apr 21, 2019, at 9:02 PM, icod...@gmail.com  wrote: 
> > 
> > I don't know about you but for me, even if there wasn't so much going 
> on, Google+ and the Go+ community was a source of info. 
> > 
> > Reddit is reddit, this whatever it is, is what it is, mewe can't 
> replace G+. 
> > Facebook just isn't the crowd. 
> > Xing and the like just aren't made to handle the task of staying 
> informed and people presenting their work. 
> > 
> > An essential source of information has disappeared. 
> > What is there to replace it? 
> > 
> > People would post links to youtube videos there, some were quite 
> interesting and some were fresh from the horses mouth about whatever 
> conferences or happenings. 
> > It's all gone now. 
> > 
> > Nuts is more of a "help I have a problem" thing. 
> > 
> > I know, Google+ had its own issues, the biggest was them forcing changes 
> onto their users no one wanted. 
> > As a result most people stopped using it and in the end it disappeared. 
> > 
> > G+ did fill a nieche, that of the enterpreteur who also wanted to be 
> entertained and catch news, stay up to date. 
> > 
> > I know this post is kind of pointless, since it won't change what is. 
> > But maybe something exists that I'm unaware of 
>
> I actually find that the Go community on Twitter fills a lot of those 
> roles for me fairly well. 
>
>
> - Dave 
>
>

-- 
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] why does reading a file on windows add CRLF to unix line endings... sometimes?

2019-04-23 Thread Constantin Konstantinidis
$ git version
git version 2.20.1.windows.1
$ go version
go version go1.12.2 windows/amd64
$ git config -l | grep autocrlf
core.autocrlf=true
core.autocrlf=true

Same issue remains intermittent. It is reproducible using git checkout -- 

Discarding changes sets default back to CRLF.
I could not locate the root cause.

-- 
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: Does fmt.Fprint use WriteString ?

2019-04-23 Thread Constantin Konstantinidis
The result is equivalent but a micro-benchmark shows that pkg io is 3x 
faster.

go version go1.12.2 windows/amd64
pkg: github.com/iWdGo/GoCompilerEfficiency/src/writestring
BenchmarkFmtWriteString-4 50  2002 ns/op
BenchmarkIoWriteString-4 200   635 ns/op
PASS


This is irrelevant is the string requires some build.
(sorry for the typo above)

-- 
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] Go+ replacement

2019-04-23 Thread David Riley
> On Apr 23, 2019, at 12:52 PM, Darko Luketic  wrote:
> 
> But Twitter is a loose group of individuals, or does it have group 
> functionality now? Everything is done via #channels last time I checked.
> I honestly very rarely use it, too small sized posts, it's very chaotic and 
> stuff you've seen just now is gone after a reload and can't be found again.
> Also it's always so political and full of journalists, so hipster, all show 
> no substance.
> Anyhow what channels or "hashtags" do you subscribe to, or can you even 
> subscribe to hashtags?

I just follow a lot of folks who talk about things I'm interested, which 
occasionally includes Go? It's not what I'd call "organized", I guess, and I 
never follow hashtags, but everyone has their own preferred interaction styles. 
 I find I can ask about Go, k8s, Rust, whatever and there are people who will 
answer things.

Make whatever value judgments you want about it, but I do find some utility 
there.


- Dave



-- 
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] ?? Does anyone know of a good on-line doc that describes how Go Garbage Collection works .. My recent web searches proved fruitless

2019-04-23 Thread Wojciech S. Czarnecki
On Tue, 23 Apr 2019 07:39:18 -0700 (PDT)
lgod...@gmail.com wrote:

> all responses appreciated 
> 

https://blog.plan99.net/modern-garbage-collection-911ef4f8bd8e?gi=da46a757afd3#.sue21l4x8

I hope this helps

-- 
Wojciech S. Czarnecki
 << ^oo^ >> OHIR-RIPE

-- 
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] ?? Does anyone know of a good on-line doc that describes how Go Garbage Collection works .. My recent web searches proved fruitless

2019-04-23 Thread Robert Engels
Try this

https://blog.golang.org/ismmkeynote

> On Apr 23, 2019, at 5:46 PM, Wojciech S. Czarnecki  wrote:
> 
> On Tue, 23 Apr 2019 07:39:18 -0700 (PDT)
> lgod...@gmail.com wrote:
> 
>> all responses appreciated 
>> 
> 
> https://blog.plan99.net/modern-garbage-collection-911ef4f8bd8e?gi=da46a757afd3#.sue21l4x8
> 
> I hope this helps
> 
> -- 
> Wojciech S. Czarnecki
> << ^oo^ >> OHIR-RIPE
> 
> -- 
> 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] Go if else syntax .. suggested replacement

2019-04-23 Thread lgodio2
It sure would be nice if Go syntax allowed programmers to replace 

if ( test) {
...do sonething
} else {
..do something else
}

with 

? (test) {
//...do something
}
{
//..do something else
}

The ? operator can be anything the Go language team considers appropriate

-- 
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] Go if else syntax .. suggested replacement

2019-04-23 Thread andrey mirtchovski
> ? (test) {
> //...do something
> }
> {
> //..do something else
> }

I believe the Go team considered this very carefully early on the
language's development and came to the decision to use "if test" for
"? (test)" and "} else {" for "}{" (without the implied newline). They
also threw in "} else if test {" for good measure, which your example
does not cover.

-- 
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] Go if else syntax .. suggested replacement

2019-04-23 Thread Robert Engels
Why? You have saved 5 characters for no practical gain. I think you would enjoy 
Ada. 

> On Apr 23, 2019, at 8:05 PM, lgod...@gmail.com wrote:
> 
> It sure would be nice if Go syntax allowed programmers to replace 
> 
> if ( test) {
> ...do sonething
> } else {
> ..do something else
> }
> 
> with 
> 
> ? (test) {
> //...do something
> }
> {
> //..do something else
> }
> 
> The ? operator can be anything the Go language team considers appropriate
> -- 
> 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] [RFC][Gomobile] Wrote a series of posts on Gomobile

2019-04-23 Thread Girish Koundinya
Hello! 

I didn't find a lot of literature on Gomobile, so I decided to write about 
what Gomobile is and how it works.

Any feedback is welcome :) 

https://blog.koundinya.xyz/series/gomobile/ 

-- 
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: how to test main function coverage with different args

2019-04-23 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 a time
>
> func Test_main(m *testing.T) {
>main2()
> }
>
>
> go test -coverprofile coverage.cov -args xxx.conf go tool cover 
> -html=coverage.cov -o coverage.html
>
>

-- 
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.