Peter Hon | 1 Aug 18:45 2014
Picon

Debug web server of GO

Dear all,

          I have written a web server with GO which is listening on 127.0.0.1:8080. I have set the breakpoint in go fiel. So what I want now is if the browser open the page, it can break at the breakpoing. Can I do that? Any thing that I need to do in order to break it when the webpage is browsed.

Thanks.

--
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 | 1 Aug 14:26 2014
Picon
Picon

problem with json marshaling

I am working around the lack of TextUnmarshal on time.Duration, I would
like the unmarshaling to work both with a string using a time.Duration
parseable form and also plain numbers. This does not work, and in ways
that I don't understand.

This playground snippet shows a stripped down version of what I want
http://play.golang.org/p/d4s2wjoQUq It fails with "error: JSON decoder
out of sync - data changing underfoot?" when given a number (works fine
with a duration string as expected). (note: the TextUnmarshal would have
a ParseInt fallback if the ParseDuration returns a missing unit error in
the production code).

This problem is clearly due to the use of TextUnmarshal, since this
snippet works http://play.golang.org/p/x0Yx56L_Ii .

Is this a bug or intended behaviour.

Related, it is not possible to unmarshal a number expressed with an
exponent into an integer (http://play.golang.org/p/Xgb1nuRF4Q). Is this
also intended?

--

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

Aleix Ventayol | 1 Aug 11:57 2014

Json encode empty struct

Hi,

I want to set a struct to empty to use the omitempty tag on the json encoding.

This is my struct:

type AppVersion struct {
 
Id        int64     `json:"id"`
 
App       App       `json:"app,omitempty"`
 
AppId     int64     `sql:"not null" json:"app_id"`
 
Version   string    `sql:"not null" json:"version"`
 
CreatedAt time.Time `json:"created_at"`
 
UpdatedAt time.Time `json:"updated_at"`
 
DeletedAt time.Time `json:"deleted_at"`
}


I want to set the App field to empty because I don't need to send it with my json.
Any idea on how to do it?

I've read that using a * can be an option, but I'm using GORM as my ORM and I think I cannot use * for relationships.

I've also thought about creating a new struct without the App field, but is there any way to assign the values between structs without writing too much code?



--
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.
Hydra Ea | 1 Aug 11:55 2014
Picon

why var s []byte is nil, but p := []byte{} is not nil

Hi All:

     Is there anybody know why? It's inconsistence.

http://play.golang.org/p/FJBobsI5-q

var s []byte
p := []byte{}
println
(s == nil)  // true
println
(p == nil)  // false

--
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.
Peter Hon | 1 Aug 11:04 2014
Picon

LightIDE debug message "No executable specified, use `target exec'".

Dear all,


        Try to debug In LightIde, I have set the BUILDARGS to -gcflags "-N -l". However, when I start debug, the following console message appear 


(gdb)

10000015^error,msg="No symbol table is loaded. Use the \"file\" command."

(gdb)

10000016^error,msg="No executable specified, use `target exec'."

(gdb)


And it does not start debug. Please Help.


Thanks.

--
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.
Peter Hon | 1 Aug 10:29 2014
Picon

lightide can't load packages

Dear all,


          I tried to build a go project in lightide. However, when it building it saids:

 c:/go/bin/go.exe build -gcflags "-N -l" [C:/go/src/Chaatz]

can't load package: package .: found packages Chaatz (Chaatz.go) and main (main.go) in C:\go\src\Chaatz

process exit no 1


What is the possible reason of it.


Thanks.

--
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.
Joshua Liebow-Feeser | 1 Aug 08:36 2014
Picon

Ideas for extensions to math/rand?

Hi All,

I'm writing a package that is intended to serve as an extension to math/rand, and I'm looking for ideas for what to include. So far the additions include:

  • Methods for all numerical types (uint8 through uint64, int8...int64, floats, and complexes)

  • Methods for random integers using the full range (that is, may generate negative numbers as well)

  • Methods for randomly generating strings (including length, which is distributed exponentially)

  • Methods for generating random instances of arbitrary types

Any ideas?


Cheers,

Josh

--
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.
mac300390 | 1 Aug 06:02 2014
Picon

StructTag for sql package documentation

Hi All,

I found this while working with gorm, is there any place where I can check all the available `sql` StructTags ? I'm looking for foreign key constraints definition - if its possible.
type Email struct { Id int64 UserId int64 Email string `sql:"type:varchar(100);"` // Set field's type Subscribed bool }

--
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.
Peter Hon | 1 Aug 05:46 2014
Picon

GO with BOSH

Dear all,

         I am using GO to communicate with Bidirectional-streams Over Synchronous HTTP. Any document on it?

Thanks

--
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.
zephyrtronium | 1 Aug 05:15 2014
Picon

[ANN] crazy: Interfaces and implementations for sources of randomness and pseudo-randomness

I've done work with math/rand beyond "give me a random number" and have had a lot of disappointment with the lack of capability and flexibility therein. Package crazy is my attempt to fix this.

http://godoc.org/github.com/zephyrtronium/crazy

While there is still a fair amount of work remaining (particularly with distributions; I still haven't grasped the ziggurat algorithm), most of it is ready to go, including the interfaces, integer and uniform float generation, and two PRNG implementations (64-bit Mersenne Twister and a 607-element LFG as in math/rand).

To get random integers quickly: rng := crazy.RNG{crazy.CryptoSeeded(crazy.NewMT64(), 128)}; x := rng.Uint64()

- Branden

--
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.
zhengkang727 | 1 Aug 05:10 2014
Picon

the best development environment

most of people said that the best development environment is mac, then linux and windows , why?

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