randomschmo | 24 Jul 21:02 2014
Picon

deploy to S3, dave cheney's cross compile

There was a recent article in the NY Times about deploying a binary to S3. I'm trying to figure out how to do this and came across Dave Cheney's crosscompilation project on github, but ran into some problems. I selected it because it said, "Go provides excellent support for producing binaries for foreign platforms without having to install Go on the target.", so my first question is

1) What type of environment(s) could I setup on S3 to do this?
2) when I tried to  follow the instructions for Cheney's crosscompilation, I got the following error running go-crosscompile-build-all
3) should that command be run from /go/src/ ?

Can anyone explain what the problem is based on the error message below?


go-crosscompile-build-all

go-crosscompile-build darwin/386

# Building C bootstrap tool.

cmd/dist

ld: can't open output file for writing 'cmd/dist/dist.ld_LQnn1T', errno=13 for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

go-crosscompile-build darwin/amd64

# Building C bootstrap tool.

cmd/dist

ld: can't open output file for writing 'cmd/dist/dist.ld_TRGGRc', errno=13 for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

go-crosscompile-build freebsd/386

# Building C bootstrap tool.

cmd/dist

ld: can't open output file for writing 'cmd/dist/dist.ld_qROuS4', errno=13 for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

go-crosscompile-build freebsd/amd64

# Building C bootstrap tool.

cmd/dist

ld: can't open output file for writing 'cmd/dist/dist.ld_703mxi', errno=13 for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

go-crosscompile-build freebsd/arm

# Building C bootstrap tool.

cmd/dist

ld: can't open output file for writing 'cmd/dist/dist.ld_JCKgIx', errno=13 for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

go-crosscompile-build linux/386

# Building C bootstrap tool.

cmd/dist

ld: can't open output file for writing 'cmd/dist/dist.ld_yo6KpV', errno=13 for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

go-crosscompile-build linux/amd64

# Building C bootstrap tool.

cmd/dist

ld: can't open output file for writing 'cmd/dist/dist.ld_n8m6no', errno=13 for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

go-crosscompile-build linux/arm

# Building C bootstrap tool.

cmd/dist

ld: can't open output file for writing 'cmd/dist/dist.ld_GxCH3m', errno=13 for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

go-crosscompile-build windows/386

# Building C bootstrap tool.

cmd/dist

ld: can't open output file for writing 'cmd/dist/dist.ld_TfnbtQ', errno=13 for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

go-crosscompile-build windows/amd64

# Building C bootstrap tool.

cmd/dist

ld: can't open output file for writing 'cmd/dist/dist.ld_hfRtpK', errno=13 for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

go-crosscompile-build nacl/amd64

# Building C bootstrap tool.

cmd/dist

ld: can't open output file for writing 'cmd/dist/dist.ld_Tib0Ah', errno=13 for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

go-crosscompile-build nacl/386

# Building C bootstrap tool.

cmd/dist

ld: can't open output file for writing 'cmd/dist/dist.ld_50nU8M', errno=13 for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

*** go-crosscompile-build-all FAILED on  darwin/386 darwin/amd64 freebsd/386 freebsd/amd64 freebsd/arm linux/386 linux/amd64 linux/arm windows/386 windows/amd64 nacl/amd64 nacl/386 ***


--
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.
Randy Schmo | 24 Jul 22:54 2014
Picon

is there advantage to running go programs as cgi scripts?

I noticed a post in the forum that said "Recent changes to the Go runtime make it possible to run
Go programs as CGI scripts on their servers."

why would someone want to run a Go program as a cgi script


second question, in your answer, please explain why anyone would want the .cgi file extension as you see here http://nf.nfshost.com/hello.cgi

--
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.
branimir.maksimovic | 24 Jul 21:17 2014
Picon

scimar2 in go

Here is scimark2 benchmark in go.
see http://math.nist.gov/scimark2/ for details.

https://github.com/bmaxa/scimark2go.git

I am novice at go, so perhaps this can be improved ;)
I just translated C version into go.

Results on my machine:

gccgo version:
gcc version 4.10.0 20140718 (experimental) (GCC)

go version devel +6a4157362cfd Wed Jul 23 07:08:52 2014 +1000 linux/amd64

1. go build -o scimark2

**                                                              **
** SciMark2 Numeric Benchmark, see http://math.nist.gov/scimark **
** for details. (Results can be submitted to pozo-R3+/ord2DXQ@public.gmane.org)     **
**                                                              **
Using       2.00 seconds min time per kernel.
Composite Score:         1021.53
FFT             Mflops:   921.81    (N=1024)
SOR             Mflops:  1228.87    (100 x 100)
MonteCarlo:     Mflops:   173.89
Sparse matmult  Mflops:  1320.03    (N=1000, nz=5000)
LU              Mflops:  1463.04    (M=100, N=100)


2. go build -gcflags -B -o scimark2

**                                                              **
** SciMark2 Numeric Benchmark, see http://math.nist.gov/scimark **
** for details. (Results can be submitted to pozo-R3+/ord2DXQ@public.gmane.org)     **
**                                                              **
Using       2.00 seconds min time per kernel.
Composite Score:         1315.67
FFT             Mflops:  1173.79    (N=1024)
SOR             Mflops:  1246.43    (100 x 100)
MonteCarlo:     Mflops:   183.80
Sparse matmult  Mflops:  1924.37    (N=1000, nz=5000)
LU              Mflops:  2049.97    (M=100, N=100)


3. go build -compiler gccgo -gccgoflags '-O3 -mavx -static' -o scimark2

**                                                              **
** SciMark2 Numeric Benchmark, see http://math.nist.gov/scimark **
** for details. (Results can be submitted to pozo-R3+/ord2DXQ@public.gmane.org)     **
**                                                              **
Using       2.00 seconds min time per kernel.
Composite Score:          759.13
FFT             Mflops:   533.60    (N=1024)
SOR             Mflops:  1174.23    (100 x 100)
MonteCarlo:     Mflops:   314.88
Sparse matmult  Mflops:   663.62    (N=1000, nz=5000)
LU              Mflops:  1109.30    (M=100, N=100)



--
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.
veegee | 24 Jul 17:22 2014

How to debug elusive signal bugs in a long-running Go program?

Hi all! I've recently ported a very simple program from Python to Go. It's job is to start and stop other programs (using os.Command and friends) at the request of other programs over ZeroMQ/tcp. I'm using these ZeroMQ bindings: https://github.com/pebbe/zmq4.

The program runs exactly as expected for days at a time, and then panics at "log.Panic("Error receiving message:", err)" with the message "Error receiving message: interrupted system call".

Apparently, the socket.RecvMessage is getting interrupted but I have no idea how, why, or where. To make things worse, this only happens once every few days after running the program for a long time. How would I go about debugging something like this? The Python program, which this is pretty much a 1:1 port of, does not suffer from the same bug.

func (pool *PJSPool) ServeForever() {
    listen_addr
:= "tcp://127.0.0.1:5555"
    log
.Println("Listening on", listen_addr)
    socket
, err := zmq.NewSocket(zmq.Type(zmq.ROUTER))
   
if err != nil {
        log
.Panic("Error creating ZMQ socket:", err)
   
}
    defer socket
.Close()
    socket
.Bind(listen_addr)

   
for {
        msgParts
, err := socket.RecvMessage(0)
       
if err != nil {
            log
.Panic("Error receiving message:", err)
       
}

        address
:= msgParts[0]

       
// decode inbound message to struct Message
        msgIn
:= &Message{}
        err
= json.Unmarshal([]byte(msgParts[1]), msgIn)
       
if err != nil {
            log
.Panic("Error decoding inbound message:", err)
       
}

       
// create a reply
        msgOut
:= pool.ProcessMessage(msgIn)

       
// encode outbound message to []byte
        msgOutBytes
, err := json.Marshal(msgOut)
       
if err != nil {
            log
.Panic("Error encoding outbound message:", err)
       
}

        _
, err = socket.SendMessage(address, string(msgOutBytes))
       
if err != nil {
            log
.Panic("Error sending message:", err)
       
}
   
}
}


--
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.
Grissiom Gu | 24 Jul 17:04 2014
Picon

Pointer to string(continuous literal) without Cgo?

Hi all,

I'm currently writing Go code interact with my hand-writing Linux kernel module under ARM. I need to do ioctl with a parameter structure which has a "char *". But I failed to do it right in Go. Here is my code so far:

================
package main

import (
        "bytes"
        "log"
        "os"
        "syscall"
        "unsafe"
)

// Keep consistent with rt_vbus_user.h
type rt_vbus_wm_cfg struct {
        low, high uint32
}
type rt_vbus_request struct {
        name      uintptr
        is_server int32
        prio      uint8
        oflag     uint32
        recv_wm   rt_vbus_wm_cfg
        post_wm   rt_vbus_wm_cfg
}

// Keep consistent with rt_vbus_user.h
const (
        VBUS_IOCREQ = 0xc020e1e2
)

func main() {
        namebuf := bytes.NewBufferString("rti\x00")
        cb := rt_vbus_request{
                name:      uintptr(unsafe.Pointer(namebuf)),
                prio:      20,
                is_server: 0,
                oflag:     uint32(os.O_RDWR),
                recv_wm:   rt_vbus_wm_cfg{500, 1000},
                post_wm:   rt_vbus_wm_cfg{500, 1000},
        }

        vcf, err := os.Open("/dev/rtvbus")
        if err != nil {
                log.Fatal("Could not open VBus control file")
        }
        r1, r2, err := syscall.Syscall(
                syscall.SYS_IOCTL,
                uintptr(vcf.Fd()),
                VBUS_IOCREQ,
                uintptr(unsafe.Pointer(&cb)))
        log.Printf("%08x %x", cb.name, string(cb.name))
        log.Println(int(r1), r2, err)
}

================

But the kernel module will get the wrong content. The content from cb.name is 0xd0 0x00 0x40 0x10, which is definitely not "rti". I cross-compiling  my code so I could not use CGo yet. So is there any way to access the underlaying literal pool 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.
Alex Casanova | 24 Jul 16:12 2014
Picon

Help understanding Sprintf

I'm using this library(https://github.com/jinzhu/gorm) to retrieve a record from a mysql database. I retrieve the record without a problem here is the struct below.


type Reseller struct {
Id            int64
Name          sql.NullString
AppDomain     sql.NullString
Installed     sql.NullInt64
MarketingType sql.NullString
Bundleurl     sql.NullString
Bundlename    sql.NullString
BundleType   sql.NullString
}


I wanted to write a simple test and I saw that I couldn't access the struct field directly and I'm curious why? The function below would return "Box Report for {Dr. XYZ true}" instead of "Box Report for Dr.XYZ"
I played around changed the function to what is below. I'm curious when does one know to use this syntax?

//Report reports on monthly usage
func (b *Box) Report() string {
var report string
report = fmt.Sprintf("Box Report for %v", b.Reseller.Name.String)

return report
}


Thanks in advanced



--
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.
energetix.user | 24 Jul 14:44 2014
Picon

Convert multiply files in one stream

So I have a code like this:



func (z *zone) Read(p []byte) (n int, err error) {
    dir
, _ := os.Open(z.Path())
    names
, _ := dir.Readdirnames(0)
   
for i := 0; i < len(names); i++ {
        dir
, _ = os.Open(z.Path() + names[i])
        n
, err = dir.Read(p)
        dir
.Close()
   
}
   
return n, err
}

It reads an all file contents in specified directory to stream. But on the exit I have only the contents of last one. How to rule out 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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Ignacio Grande | 24 Jul 14:37 2014
Picon

Semaquire issues

Hello all.


I've been playing with a cache-oblivious algorithm, more or less as described here: http://www.1024cores.net/home/parallel-computing/cache-oblivious-algorithms and for big input parameters, on go1.3 windows/386 and go1.3 linux/amd64 (I cannot test with tip right now), and I'm getting all kind of strange errors if the input size N is too big (like in the Playground). In linux amd64 the problem appears if I use -race.

Code with the problem here: http://play.golang.org/p/VxRcS9qM4Z

Usually I'm getting hundreds of errors like these:
fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x0 pc=0x4ae480]

goroutine 7920 [running]:
runtime.throw(0x5c87a5)
        /home/iggg/go/src/pkg/runtime/panic.c:520 +0x69 fp=0x7f09c39b8e20 sp=0x7f09c39b8e08
runtime.sigpanic()
        /home/iggg/go/src/pkg/runtime/os_linux.c:222 +0x3d fp=0x7f09c39b8e38 sp=0x7f09c39b8e20
invalid spdelta 372112 788100
runtime: unexpected return pc for _ZN11__sanitizer15internal_memsetEPvim called from 0x0
_ZN11__sanitizer15internal_memsetEPvim()
        ?:0 +0x10 fp=0x7f09c3a794c4 sp=0x7f09c39b8e38
created by main.recursive
        /home/iggg/k/k.go:37 +0x21c

goroutine 16 [semacquire]:
sync.runtime_Semacquire(0xc208122570)
        /home/iggg/go/src/pkg/runtime/sema.goc:199 +0x30
sync.(*WaitGroup).Wait(0xc208124040)
        /home/iggg/go/src/pkg/sync/waitgroup.go:129 +0x1ca
main.recursive(0xc20803a000, 0x4e20, 0x4e20, 0xc208062000, 0x4e20, 0x4e20, 0x10)
        /home/iggg/k/k.go:50 +0x421
main.main()
        /home/iggg/k/k.go:66 +0x2a3

goroutine 19 [finalizer wait]:
runtime.park(0x4140b0, 0x5de500, 0x5cb389)
        /home/iggg/go/src/pkg/runtime/proc.c:1369 +0x89
runtime.parkunlock(0x5de500, 0x5cb389)
        /home/iggg/go/src/pkg/runtime/proc.c:1385 +0x3b
runfinq()
        /home/iggg/go/src/pkg/runtime/mgc0.c:2644 +0xcf
runtime.goexit()
        /home/iggg/go/src/pkg/runtime/proc.c:1445


however, some times the execution stops with a:
==12760==ERROR: ThreadSanitizer failed to allocate 0x80000 (524288) bytes at address 105774531084288 (12)
FATAL: ThreadSanitizer can not mmap thread trace (0x60338d5a0000/0x000000080000->0xfffffffffffffff4)


Is this expected? Is it a bug or something wrong with my program? 

Thank you.

--
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.
Phil Sugarman | 24 Jul 12:49 2014
Picon

This suggestion might be against Go philosophy..

..but right now it'd be really cool if this syntax was supported too: http://play.golang.org/p/A_25mTr5CE

--
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.
Donovan Hide | 24 Jul 12:12 2014
Picon

Go Playground reuse for "smart contract" execution

Hi,

here's a link to a slightly vapourware specification for a system to run "smart contracts" in a sandboxed environment:


Particularly:


I was reading up on how the Go Playground is actually implemented and I'm a little bit unsure of how much of the code is open source. Say that I wanted to experiment with setting up a "Smart Contract" NaCl sandbox, how much of Google's Playground Appengine code to limit the resource usage and fake network access and time is available for reuse? There are a lot of parallels between what is described in that whitepaper and the Playground so it would be great to try and make use of it.

Cheers,
Donovan.


--
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.
Igor Avdoshkin | 24 Jul 11:26 2014
Picon

Golang Change-of-Authorization Messages (CoA)

Hello! Who is the source of the implementation of the client Change-of-Authorization Messages (CoA)?

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