minecraftman7778 | 27 Jul 09:27 2015
Picon

Question on Go's scheduler

So I am have been messing around with Go for a few reasons, mainly it's concurrency. I love goroutines and channels! My question is this: If I set GOMAXPROCS to how many hardware threads I have and spawn 8 goroutines, will each goroutine get it's own hardware thread? I assume this is heavily affected by the OS scheduler too right? If anyone can shed light on this for me I would be very grateful.
BTW in case you're wondering I am currently on Win7 with Go 1.4.2. 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.
David Bariod | 27 Jul 11:07 2015

Mixed C and go

Hello,

The context is a mixed C and got project.
I was wondering iwaht is the proper way to compute the relink of a go binary generated through go install when the C build library or C header files on which the binary depends ?
It seems the go install only relink the binary when the go files has been updated and completely ignores any depending C header files or C files build product used for link.

David Bariod

--
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.
Kane Kim | 27 Jul 16:23 2015
Picon

syscall.SetReadDeadline

Where is source code for this function?

--
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.
Damian Gryski | 27 Jul 15:58 2015
Picon

Fuzz-a-thon!

By now hopefully everybody has heard about Dmitry Vyukov's go-fuzz: https://github.com/dvyukov/go-fuzz

This randomized testing tool has found a huge number of bugs in the standard library.  But it has been used in relatively few third-party packages.

In the week or so leading up to the release of 1.5, we as a community should turn out attention to the rest of the ecosystem.  Go is already known for reliability due to the ingrained habit of error checking.  Gracefully handling unexpected inputs is another area in which we ought to excel.

Getting started is straight forward -- the README file lays out the steps: https://github.com/dvyukov/go-fuzz/blob/master/README.md

You can start with your own packages, a dependency you use, or just pick a random one from https://github.com/avelino/awesome-go .  Good candidates are file formats, protocols, and parsers.  Basically anything that's dealing with user input in some form.

For the bugs you find, file a bug to the repository, preferably with a fix. And don't forget to file one to update go-fuzz's trophy case.

It doens't take a lot of time, either.  Dmitry has obviously expended lots of CPU time across all the packages he tested, but even 30 minutes of fuzzing on a laptop is enough to generally shake out a few crashers.

Tweet your successes tagging it with #golangfuzz

Damian

--
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.
Matt Joiner | 27 Jul 14:32 2015
Picon

Reconstruct HTTP client request URL

The http.Request struct contains the URL field that says

// URL specifies either the URI being requested (for server
// requests) or the URL to access (for client requests).

// For server requests the URL is parsed from the URI 
// supplied on the Request-Line as stored in RequestURI. For 
// most requests, fields other than Path and RawQuery will be 
// empty. (See RFC 2616, Section 5.1.2)

How should I obtain a url.URL that represents what the client would have used in initiating the request?

--
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.
Игорь Мозговой | 27 Jul 11:46 2015
Picon

SQL and non-existent object

Hello everybody. Could someone help me? I have a problem with a testing my code. If i try to get non-exist object, i catch an error: http: request method or response status code does not allow body. How i can fix it? Thank You!

func RetrievingAddress (w rest.ResponseWriter, r *rest.Request){

objectId := r.PathParam("objectId")

var req AddressToGet

row:= con.QueryRow("select objectId, address1, address2, city, state, venueName, zip, ACL, "+
"DATE_FORMAT(createdAt,'%Y-%m-%dT%T.%fZ') as ct, DATE_FORMAT(updatedAt,'%Y-%m-%dT%T.%fZ') as ut from address "+
"where objectId =?", objectId)
err := row.Scan(&req.ObjectId, &req.Address1, &req.Address2, &req.City, &req.State, &req.VenueName, &req.Zip, &req.ACL, &req.CtratedAt, &req.UpdatedAt)
if err != nil{
rest.Error(w,"object not found for get",101)
return
}
w.WriteJson(req)
}

--
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.
bojan85 | 27 Jul 10:16 2015
Picon

Re: godep - declare dependency on a command

Good point.

Manual edit will be overwritten by next can to godep save.

On Friday, July 24, 2015 at 10:25:52 PM UTC+2, Guillaume J. Charmes wrote:
You should send this kind of question to godep's github issues.

To answer your question, the easiest way would be to manually edit your Godeps/Godeps.json and add the entry for stringer.

If you send an issue to godep's github, they might add the feature to make it automatic.

Regards,
-- 
 
Guillaume J. Charmes
about.me/guillaumecharmes
 

On Fri, Jul 24, 2015 at 9:15 AM, <boj...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
I am using an golang.org/x/tools/cmd/stringer to go:generate. Is there a way to declare the dependency to stringer so that "godep restore" or "godep get" fetch and install stringer?

--
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...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Zac Bergquist | 27 Jul 00:22 2015
Picon

gorename character offset

The gorename tool accepts a byte offset of an identifier to rename.  What are your thoughts on adding support for a character offset too?

The invocation could look something like this:

gorename -offset file.go#123 -to foo         # traditional byte-offset
gorename -offset file.go#C123 -to foo        # new character-offset

The motivation for such a change is that some editors (ie Atom) keep track of the cursor position as a character index and not a byte index.  You could argue that the editor should be responsible for doing the conversion, but since Go handles unicode so well, the implementation in gorename would be simple and all editors could benefit.

I would gladly take a stab at this work if there is consensus that it's the right thing to do.

Thanks!
Zac

--
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.
Morpheus82 | 26 Jul 03:30 2015
Picon

File processing in Golang

Need some guidance for a small project that I am trying to do for hybrid storage.

I want to process a flat file by
a) Sorting the flat file based on a certain field/column
b) Split the file into multiple files based on the field/column
c) move the files to separate storage boxes (can be mongo, box, oracle etc).

I am able to do a and b easily with awk shell scripts. But finding it a bit difficult to connect to cloud based storage in point c.
I am writing a small project using Golang where I will be able to consume a file, sort/split the file. You can consider this as a flat file with multiple records.

I started with type struct and ioutil, but unable to move the  file data into predefined structure, unable to sort. Suddenly my hands on frozen to rethink if gaoling is the right language for something I want to do. Any help or samples will be great.

--
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.
jake pittis | 26 Jul 21:22 2015
Picon

Unidiomatic Test Helper Function

One pattern I've seen come up all the time in my tests is the following:

select {
case <-somethingImportantToFinish:
case <-time.After(1 * time.Second):
    t.Error("something important did not finish in time")
}

At one point, I decided to stick it into a helper function that I could use across my tests.

func WaitFor(t *testing.T, done chan struct{}, timeout time.Duration) {
    select {
    case <-done:
    case <-time.After(timeout):
        t.Error("WaitFor timed out")
    }
}

This makes for prettier tests but when a test faisl, it's a pain to figure out which WaitFor triggered the failure.

I guess another option would be to do the error logging outside.

err := WaitFor(somethingImportantToFinish, 1 * time.Second)
if err != nil {
    t.Error(err)
}

I'm now wondering what other people think is the most idiomatic way to write test helper functions.

--
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.
Matt Joiner | 26 Jul 20:53 2015
Picon

go1.5 race detector false positives?

Recently I've started getting a lot of (what should be) false positives running with go test -race.

WARNING: DATA RACE

Read by goroutine 99:

  sync.raceRead()

      /Users/anacrolix/src/go.master/src/sync/race.go:37 +0x2e

  sync.(*WaitGroup).Add()

      /Users/anacrolix/src/go.master/src/sync/waitgroup.go:66 +0xfa


Previous write by goroutine 15:

  sync.raceWrite()

      /Users/anacrolix/src/go.master/src/sync/race.go:41 +0x2e

  sync.(*WaitGroup).Wait()

      /Users/anacrolix/src/go.master/src/sync/waitgroup.go:124 +0xf9


It's usually followed by a crash that seems to indicate that two goroutines were able to occupy a critical section at the same time.


$ go version

go version devel +d23973d Fri Jul 24 05:19:09 2015 +0000 darwin/amd64


$ go env

GOARCH="amd64"

GOBIN=""

GOEXE=""

GOHOSTARCH="amd64"

GOHOSTOS="darwin"

GOOS="darwin"

GOPATH="/Users/anacrolix/gopath"

GORACE=""

GOROOT="/Users/anacrolix/src/go.master"

GOTOOLDIR="/Users/anacrolix/src/go.master/pkg/tool/darwin_amd64"

GO15VENDOREXPERIMENT=""

CC="clang"

GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"

CXX="clang++"

CGO_ENABLED="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.

Gmane