gima | 16 Apr 16:39 2015
Picon
Picon

How does go runtime represent/handle strings?

Am I correct in thinking that in Go,

  • The underlying representation of string is a pointer.
  • All strings whose content wasn’t known at compile-time AND who CAN escape the current scope are heap-allocated and garbage-collected like any other. Those who can’t escape the current scope are allocated on the stack.
  • All strings whose content are known at compile-time reside in the compiled image (and hence, memory) and point to that memory.

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.

michaliskargakis | 16 Apr 14:07 2015
Picon

Read twice from the same io.Reader

How can I do that? If I was reading from a file instead, I would probably run file.Seek(0,0) in between the reads, but how can this be done with io.Readers?

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
subahjit | 16 Apr 12:04 2015
Picon

Go test coverage results incorrect for test code in different package than the src code

Hi,
When a  *_test .go files is placed in the same package as the corresponding src.go file the go test --cover reports the correct code coverage.
But when the package of the test files is different than the src code package, the test coverage results are incorrect.

Any suggestions on how to get the correct coverage results?

Thanks in advance,
Subhajit Datta

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
flamkuavos | 16 Apr 10:26 2015
Picon

In golang, can I start a websocket client through SOCK5 proxy?

Thanks a lot!

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Dan Kortschak | 16 Apr 01:21 2015
Picon
Picon

Go project (Docker) mentioned in science journal Nature

http://www.nature.com/news/rule-rewrite-aims-to-clean-up-scientific-software-1.17323?WT.ec_id=NATURE-20150416

```
Worried about a rising tide of results that fail to measure up, journals
are starting to take action. In the latest such move, Nature
Biotechnology announced on 7 April a plan to prevent such embarrassing
episodes in its pages (Nature Biotechnol. 33, 319; 2015). Its peer
reviewers will now be asked to assess the availability of documentation
and algorithms used in computational analyses, not just the description
of the work. The journal is also exploring whether peer reviewers can
test complex code using services such as Docker, a piece of software
that allows study authors to create a shareable representation of their
computing environment.
```

--

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

Davide Moriello | 15 Apr 22:55 2015
Picon

Json noob here - Need advice

Hi GO community,

I need another time your help. I'm pretty noob with json and json parsing so here is the code


{"attributes":{"151":{"id":"151","code":"shoe_size","label":"Schuhgr\u00f6\u00dfe","options":[{"id":"88","label":"35","price":0,"oldPrice":"0.0000","products":["25405"],"is_salable":true,"backPrice":"148","backOldPrice":"148"},{"id":"87","label":"35,5","price":"0","oldPrice":"0","products":["25406"],"is_salable":false},{"id":"86","label":"36","price":0,"oldPrice":"0.0000","products":["25407"],"is_salable":true,"backPrice":"148","backOldPrice":"148"},{"id":"85","label":"36,5","price":0,"oldPrice":"0.0000","products":["25408"],"is_salable":true,"backPrice":"148","backOldPrice":"148"},{"id":"84","label":"37","price":0,"oldPrice":"0.0000","products":["25409"],"is_salable":true,"backPrice":"148","backOldPrice":"148"},{"id":"83","label":"37,5","price":"0","oldPrice":"0","products":["25410"],"is_salable":false},{"id":"82","label":"38","price":0,"oldPrice":"0.0000","products":["25411"],"is_salable":true,"backPrice":"148","backOldPrice":"148"},{"id":"81","label":"38,5","price":0,"oldPrice":"0.0000","products":["25412"],"is_salable":true,"backPrice":"148","backOldPrice":"148"},{"id":"80","label":"39","price":0,"oldPrice":"0.0000","products":["25413"],"is_salable":true,"backPrice":"148","backOldPrice":"148"},{"id":"79","label":"39,5","price":"0","oldPrice":"0","products":["25414"],"is_salable":false},{"id":"78","label":"40","price":0,"oldPrice":"0.0000","products":["25415"],"is_salable":true,"backPrice":"148","backOldPrice":"148"},{"id":"77","label":"40,5","price":"0","oldPrice":"0","products":["25416"],"is_salable":false},{"id":"76","label":"41","price":"0","oldPrice":"0","products":["25417"],"is_salable":false},{"id":"74","label":"42","price":"0","oldPrice":"0","products":["25418"],"is_salable":false}]}},"template":"#{price}\u00a0\u20ac","basePrice":"148","oldPrice":"148","productId":"25422","chooseText":"Option w\u00e4hlen\u2026","taxConfig":{"includeTax":true,"showIncludeTax":true,"showBothPrices":false,"defaultTax":22,"currentTax":22,"inclTaxTitle":"Inkl. Steuern"}}

I know how to parse simple json strings but this... it's a bit different.

More for the first part 
{"attributes":{"151":{

that I really don't need, what I really need is only "label" and "is_salable" I don't care anything else.


Thank you for any help =)
    

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Jason Buberel | 15 Apr 21:26 2015
Picon

Go Developer Community Survey

Hello Gophers,


The Go team would like you to complete a very short survey (http://bit.ly/1cws9JE) about your development and deployment environment. The data will be used to help us determine priorities for a few upcoming projects. No login is required, and no identifying information will be captured.


The survey will be open until 2015-05-01, and we will share the results of the survey with the Go developer community.


Thanks,
jason

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
William Krause | 15 Apr 17:23 2015
Picon

Golang Sessionless Authentication with Google OAuth2 Part 1

Hey Everyone,

I wrote a tutorial on how to authenticate users through Google Oauth2 that doesn't require sessions or cookies. Let me know if there are any glaring errors or omissions, this is my first pass at this work flow. 

http://hobbyisthacker.com/golang-sessionless-authentication-with-google-oauth2-part-1/

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Сергей Жуматий | 15 Apr 13:47 2015
Picon

Smart logger?

Hello!

In my program I use several dynamically created goroutines and I want to write logs with goroutine name prefix. Name is set inside goroutine. I cannot just pass this name to logger function, because I use logging in many functions and passing name to EVERY function is crazy.

Is there way to make something like lambda or something else to implement "local" version of logger function, which is different for each goroutine context? I don't want to replace log package, just to implemet function like my_log(format, ...), which prints prefix and then formatted string.

Any ideas? Is is even possible in go?

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Nguyên Nguyễn Thế | 15 Apr 11:56 2015
Picon

Where I find a seed app with gin and gorm?

How do I create seed web app with gin and gorm? 

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
John Souvestre | 15 Apr 11:15 2015

Sorting UTF-8 Strings

Hi.

 

I’m just starting to use Unicode and am looking for some guidance.

 

I'm interested in sorting a slice of UTF-8 strings in lexicographical order (code point by code point, based simply on its numeric value), ignoring duplicate/equivalent normalization and language/locale collation issues for now.  I've seen it said in a few places that this can be done by treating each of the strings as a series of bytes and sorting accordingly. 

 

I don't see how this can possibly work, however.  If all of the code points used the same number of bytes, fine, but that's not the case.  A UTF-8 code point can use one to six bytes.  Thus you might end up comparing a byte of one code point to a byte of another code point.

 

I would think that you would have to convert the UTF-8 string to a rune string (or walk the UTF-8 string a rune at a time).  Fine, but wouldn't you have to allow for combined code points, for example one with a diacritical mark(s)?  You would really have to walk the string a combined code point at a time, right?

 

Does Go offer any support to extract combined code point (base code point plus any combiner code points) from a UTF-8 string or a slice of runes?

 

Once I get this much figured out, I’ll worry about normalization and collation.  J

 

Note:  For doing solely numeric sorts, I do see that there is a library unicode/IsDigit function which identifies digits for all of the languages.

 

Thanks,

 

John

    John Souvestre - New Orleans LA

 

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.


Gmane