[go-nuts] Re: Help translate x86-64 assenbly to Go assembly

2017-01-16 Thread lars
Managed to get this working The Go implementation now returns a monotonic time and works on 64 bit Intel Macs. Updated version at https://gist.github.com/namsral/376d0f063f631593a52e3f5b439e289c#file-time_amd64-v2-s On Tuesday, January 17, 2017 at 4:36:27 AM UTC+1, la...@namsral.com wrote: >

[go-nuts] Re: Test code that interacts with private variables and doesn't bloat binary

2017-01-16 Thread Volker Dobler
I' unsure if I understand the problem but code in *_test.go is not compiled into the production binary, so there is no need to extract test code into its own package: Keeping this in _test.go is probably okay. V. Am Dienstag, 17. Januar 2017 08:28:34 UTC+1 schrieb alcub...@gmail.com: > > I'm try

[go-nuts] Re: Using GitHub projects with a local Go Environment

2017-01-16 Thread mhhcbon
A package is just a folder. So you may have a repository having multiple packages for the same project, the project, among others, uses this layout, https://golang.org/pkg/ <> https://github.com/golang/go/tree/master/src. This said, for a go project hosted on github, you create a dir such as

Re: [go-nuts] exec.Command("cp", "-r", "./*.json", artifact.dir fails with exit status 1

2017-01-16 Thread Konstantin Khomoutov
On Mon, 16 Jan 2017 13:35:07 -0800 (PST) Deepak Jain wrote: > util.ExecuteCommandWithOuput(exec.Command("cp", "-r", "./*.json", > artifact. dir)) > > func ExecuteCommandWithOuput(cmd *exec.Cmd) { > output, err := cmd.Output() > if err != nil { > log.Print("Error executing ", cmd.Args, err) > } >

[go-nuts] Test code that interacts with private variables and doesn't bloat binary

2017-01-16 Thread alcubecker
I'm trying to test my packages without bloating the size of the binary. Currently this consists of moving the test code into a test/ subdirectory. If there's a better way to handle this, e.g. tree-shaking, please let me know. Unfortunately, I have a package that needs to be initialized before u

[go-nuts] Re: HTTP Server - Force close connection after response

2017-01-16 Thread Rodolfo Azevedo
You can use defer: defer bufrw.Flush() defer conn.Close() It will close after method finishs, but I do not know if it will work for you because you using go routines to start server, I never see this, I always use: log.Fatal(http.ListenAndServe(":8080", mux)) Well, I think you can try. Em

[go-nuts] Re: exec.Command("cp", "-r", "./*.json", artifact.dir fails with exit status 1

2017-01-16 Thread Dave Cheney
The problem is expanding shell meta characters like *, ? and ~ is a property of the _shell_, as Dan mentioned above. You are executing a command directly so the shell is not involved and cannot expand *.json into a list of files ending with .json. A cheap solution to this might be something lik

[go-nuts] Re: Reading an .ini file

2017-01-16 Thread Nathan Kerr
Do you have a better suggestion? On Tuesday, January 17, 2017 at 3:52:49 AM UTC+1, hui zhang wrote: > > this package is quit buggy > check its issues, I list some , and still not fix yet > > 在 2017年1月15日星期日 UTC+8上午1:43:55,Nathan Kerr写道: >> >> Using a newer package might help. >> >> https://gith

[go-nuts] Re: exec.Command("cp", "-r", "./*.json", artifact.dir fails with exit status 1

2017-01-16 Thread Deepak Jain
I appended pwd command output to source directory, i still get same error. pwd := util.ExecuteCommandWithOuput(exec.Command("pwd")) fmt.Println("pwd", pwd) util.ExecuteCommandWithOuput(exec.Command("cp", "-r", pwd+"/./*.json", artifact.dir)) Output: Cmd:[cp -r /Users/userId/sd101 /./*.json mya

Re: [go-nuts] exec.Command("cp", "-r", "./*.json", artifact.dir fails with exit status 1

2017-01-16 Thread Deepak Jain
Thanks for Stderr. I would like to do a recursive copy of a directory (similar to cp -r ), directory can contain files (binaries or text files) and directories. I now see exit status 1: cp: ./*.json: No such file or directory Code: //ExecuteCommandWithOuput will execute cmd passed as argumen

[go-nuts] Applying idiomatic Golang patterns to other languages?

2017-01-16 Thread so . query
Just curious how often you find yourself applying idiomatic Go patterns to other languages? (JavaScript, Python, C#, Java) For instance returning and handling an error value as opposed to throw-try-catch. I understand this isn't the best example since try-catch exceptions are more closely align

Re: [go-nuts] HTTP Server - Force close connection after response

2017-01-16 Thread Tony Grosinger
Isn't that just asking the client to close the connection? I need to not trust the client and force the connection to close. -- 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 a

Re: [go-nuts] HTTP Server - Force close connection after response

2017-01-16 Thread Sairam Kunala
You could respond with "Connection: close" header On Tue, Jan 17, 2017 at 12:41 AM, Tony Grosinger wrote: > I would like to create an HTTP server which forces the connection to be > closed after writing the response. > For example: > > func closingHandler(w http.ResponseWriter, r *http.Request)

Re: [go-nuts] exec.Command("cp", "-r", "./*.json", artifact.dir fails with exit status 1

2017-01-16 Thread Dan Kortschak
Before answering the questions below, you should know that exec.Command will not do shell glob expansion since it does not invoke commands via a shell. If you want to do that you can either invoke via a shell or do the globbing yourself with filepath.Glob[1]. 1. You can capture the combined output

[go-nuts] Help translate x86-64 assenbly to Go assembly

2017-01-16 Thread lars
I want to add monotonic time to Go's runtime on macOS (x86-64) by replacing Go's runtime,nanotime() to macOS' mach_absolute_time(). So far my Go assembly compiles but it returns the seconds since 1970-01-01 instead of what mach_absolute_time() returns. What I have so far: https://gist.github.co

[go-nuts] RE: Using GitHub projects with a local Go Environment

2017-01-16 Thread tahir . usman . ali94
I recently set up a Go workspace environment on my Linux machine (running Ubuntu 16.04), and I was able to setup GOPATH successfully, so that any code I write in my src/ folder can be installed and sent to my bin/ folder, and any custom packages I write in src/ (under a new sub-directory) can be

[go-nuts] Re: Remote address in SSH DialTCP must be IP address

2017-01-16 Thread Tony Grosinger
That worked perfectly, thanks Dave. On Friday, January 13, 2017 at 12:09:35 PM UTC-8, Dave Cheney wrote: > > I'm pretty sure you can use the Dial method above, DialTCP was added to > avoid using the DNS server at the remote end (I think, it's been years) -- You received this message because you

[go-nuts] Re: My own Golang Playground?

2017-01-16 Thread mikael . allison
Hi, Could you please elaborate? I don't seem to have the `tour` tool. How do you get it? Is it third party? On Tuesday, 24 May 2016 16:05:57 UTC+1, NagaSrinivasVinodKumar Panda wrote: > > "go tool tour" > That is it.. You have all you need with it, to have your exploration > offline.. > > On

[go-nuts] HTTP Server - Force close connection after response

2017-01-16 Thread Tony Grosinger
I would like to create an HTTP server which forces the connection to be closed after writing the response. For example: func closingHandler(w http.ResponseWriter, r *http.Request) { // Respond before hijacking? fmt.Fprintf(w, "Hello World") hj, ok := w.(http.Hijacker) if !ok {

[go-nuts] transport: http2Server.HandleStreams failed to read frame: read tcp 192.168.56.1:8080->192.168.56.1:29065: wsarecv: An existing connection was forcibly closed by the remote host.

2017-01-16 Thread Nikhil Tathe
Hi all, I am building a grpc server client communication on windows. I am getting error as transport: http2Server.HandleStreams failed to read frame: read tcp 192.168. 56.1:8080->192.168.56.1:29065: wsarecv: An existing connection was forcibly closed by the remote host. I am not able understand i

[go-nuts] exec.Command("cp", "-r", "./*.json", artifact.dir fails with exit status 1

2017-01-16 Thread Deepak Jain
util.ExecuteCommandWithOuput(exec.Command("cp", "-r", "./*.json", artifact. dir)) func ExecuteCommandWithOuput(cmd *exec.Cmd) { output, err := cmd.Output() if err != nil { log.Print("Error executing ", cmd.Args, err) } fmt.Print(string(output)) } Output 2017/01/16 13:26:35 Error executing [cp -

[go-nuts] Re: Reading an .ini file

2017-01-16 Thread hui zhang
this package is quit buggy check its issues, I list some , and still not fix yet 在 2017年1月15日星期日 UTC+8上午1:43:55,Nathan Kerr写道: > > Using a newer package might help. > > https://github.com/go-ini/ini looks to be under active development and is > written by the author of https://github.com/Unknw

Re: [go-nuts] Question on rune literals in golang spec

2017-01-16 Thread spencer
> It cannot; that's why it's an error if attempted. > > The parenthesized phrase is redundant but explanatory. > Thank you, Commander Rob :). As a newbie I was suspicious that the phrase "(it is not a single code point)" had some deep implication that I did not understand. Might I suggest di

Re: [go-nuts] Sort bitcoin addresses

2017-01-16 Thread Anonymous
I would like to see only the addresses appear in 1L without any holes or 128 per page -- 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...@goo

[go-nuts] Re: Disadvantage of Go

2017-01-16 Thread as . utf8
To sacrifice simplicity of readability for simpler writing is to have never been tasked with reading a 25kloc C# project and having to open 10 windows just for the object-oriented pyramid of generic abstract partial template class factories On Thursday, January 12, 2017 at 11:44:10 PM UTC-8,

[go-nuts] Re: shiny: get mouse position relative to window

2017-01-16 Thread as . utf8
I haven't seen this either, the solution depends on what platform you're trying to support. I have a package that does this, for Win32. If you're using Windows, you use the the Rect() or ClientAbs() in my package to get the position of the window (or the client area). https://godoc.org/github