Re: [go-nuts] Setting up GOPATH

2017-03-17 Thread Ian Lance Taylor
On Fri, Mar 17, 2017 at 8:10 PM,   wrote:
> Hello,
> For some reason, no matter what i do, i just can't seem to get the go path
> to work.
> My tree(not entirely sure what it is):
> -documents
> - golang
>- src
>- hello1
> hello1 is where i have my code
>
> when ever i try and do go install i get this message.
>
> go install: no install location for directory
> /Users/samgreenhill/documents/golang/src/hello1 outside GOPATH
>
> For more details see: 'go help go path'
>
>
> After looking it up, i tried to customize my .bash_profile and i put this
>
> export GOROOT="/usr/local/go"
>
> export GOPATH="/Users/samgreenhill/documents/golang"
>
> export PATH="/Users/samgreenhill/documents/golang/bin:$PATH"
>
>
> and it still returned the same message
>
> Sams-MBP:hello1 samgreenhill$ go install
>
> go install: no install location for directory
> /Users/samgreenhill/documents/golang/src/hello1 outside GOPATH
>
> For more details see: 'go help gopath'
>
> Sams-MBP:hello1 samgreenhill$
>
>
>
> i am curious what i am doing wrong.

What does `go env` print?

Ian

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


[go-nuts] Setting up GOPATH

2017-03-17 Thread samgusaapp1993
Hello,
For some reason, no matter what i do, i just can't seem to get the go path 
to work. 
My tree(not entirely sure what it is):
-documents
- golang
   - src
   - hello1
hello1 is where i have my code

when ever i try and do go install i get this message. 

go install: no install location for directory 
/Users/samgreenhill/documents/golang/src/hello1 outside GOPATH

For more details see: 'go help go path'


After looking it up, i tried to customize my .bash_profile and i put this

export GOROOT="/usr/local/go"

export GOPATH="/Users/samgreenhill/documents/golang"

export PATH="/Users/samgreenhill/documents/golang/bin:$PATH"


and it still returned the same message

Sams-MBP:hello1 samgreenhill$ go install

go install: no install location for directory 
/Users/samgreenhill/documents/golang/src/hello1 outside GOPATH

For more details see: 'go help gopath'

Sams-MBP:hello1 samgreenhill$ 



i am curious what i am doing wrong. 

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


[go-nuts] [ANN] Go client for Chrome devtools

2017-03-17 Thread Raffaele Sena
Now that headless support for Chrome is becoming available I decided I am 
fed-up trying to deal with phantomjs and related problems. And because I 
love Go and didn't see an available client, I decided to build my own: 
https://github.com/raff/godet

Still in the early stages (a week old ?), but it's usable. It doesn't 
really check for protocol.json but just assumes you are running a 
relatively new version of Chrome (again, I am planning to use for headless 
support, so it's going to be Chrome 57+).

In theory it should work everywhere but I am testing (for now) mainly on 
MacOS (where headless doesn't work, but I can test the protocol).

The example/command line should give you a good idea of how to use it (and 
it may be useful on its own).

Let me know what you think, and if you have any suggestions!

-- Raffaele

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


Re: [go-nuts] Re: [ANN] fsq 1.4.0 released

2017-03-17 Thread Matt Harden
It's common to use go get to download programs as well, for instance
goimports.

On Sun, Mar 12, 2017, 21:25  wrote:

> Thanks for the input! By 'checking', I assume you mean check y.go into the
> git repository. I realize the motivation for this (go get), but since
> parser.y contains the actual change history (while y.go is generated), I
> tend to lean in favor of only versioning the yacc source. If fsq was meant
> to be used as a library, I could see a reasonably compelling case for this,
> however.
>
> --
> 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...@googlegroups.com.
> 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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: golint if/else stmt and early returns

2017-03-17 Thread jmontgomery
While there may be better ways to express what this logic, for clarity, 
here is the change that golint is actually suggesting:
// Load returns the list of partition found and their properties.
func (l *LinuxLoader) Load() ([]*Properties, error) {
//-
ret := []*Properties{}

if temp, err := runDf(); err != nil {
return ret, err
}
ret = PropertiesList(ret).Append(PropertiesList(temp))
//-
if temp, err := runLsLabel(); err != nil {
return ret, err
} else {
ret = PropertiesList(ret).Append(PropertiesList(temp))
}
//-
if temp, err := runLsUsb(); err != nil {
return ret, err
} else {
ret = PropertiesList(ret).Merge(PropertiesList(temp), "IsRemovable")
}
//-
if temp, err := runMount(); err != nil {
return ret, err
} else {
ret = PropertiesList(ret).Merge(PropertiesList(temp), "Label")
}
//-
return ret, nil
}

The change is at line 9.



On Thursday, March 16, 2017 at 1:11:28 PM UTC-4, mhh...@gmail.com wrote:
>
> Hi,
>
> golint will report
>
> if block ends with a return statement, so drop this else and outdent its 
> block (move short variable declaration to its own line if necessary) 
> (golint)
>
> for this code,
>
>
> // Load returns the list of partition found and their properties.
> func (l *LinuxLoader) Load() ([]*Properties, error) {
> //-
> ret := []*Properties{}
>
> if temp, err := runDf(); err != nil {
> return ret, err
> } else {
> ret = PropertiesList(ret).Append(PropertiesList(temp))
> }
> //-
> if temp, err := runLsLabel(); err != nil {
> return ret, err
> } else {
> ret = PropertiesList(ret).Append(PropertiesList(temp))
> }
> //-
> if temp, err := runLsUsb(); err != nil {
> return ret, err
> } else {
> ret = PropertiesList(ret).Merge(PropertiesList(temp), 
> "IsRemovable")
> }
> //-
> if temp, err := runMount(); err != nil {
> return ret, err
> } else {
> ret = PropertiesList(ret).Merge(PropertiesList(temp), "Label")
> }
> //-
> return ret, nil
> }
>
> Does it mean i should nest those stmts and let it be 4 level deep ?
> Is it the reco ?
>
> Is there something wrong about early returns ?
>
> 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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Guetzli perceptual JPEG encoder for Go

2017-03-17 Thread chaishushan
https://github.com/chai2010/guetzli-go
https://github.com/google/guetzli

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


[go-nuts] Naming tests with underscores

2017-03-17 Thread sethkoehler via golang-nuts
Hi all,

In Go, is it acceptable to name tests using underscores for logical 
grouping of the specific scenario you're testing (e.g., 
TestFuncName_NilFoo_OneBar), or should one never use underscores for 
logical grouping (e.g., is TestFuncNameNilFooTwoBars preferred)?  I've seen 
this in a few places with underscores in various stack-overflow postings 
and articles, and feel it helps readability of the test name and 
understanding what scenario is being tested, but couldn't find anything 
definitive on it.

And given the recommendation of splitting non-error and error cases up 
,
 
if underscores are ok, would it then be reasonable to name the tests where 
FuncName does not produce an error TestFuncName_{Scenario} and the tests 
that should produce an error TestFuncName_{Scenario}_Errors?

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


Re: [go-nuts] static compile binary with newlib instead of glibc

2017-03-17 Thread Vasiliy Tolstov
2017-03-17 16:59 GMT+03:00 Ian Lance Taylor :
> Go can statically link a binary without any C library at all.  The
> question of using a C library only comes in when cgo to call C code.
> I suspect that right now Go programs that use cgo will fail to build
> with newlib, because the runtime/cgo package expects to be able to
> call functions like pthread_create that, last time I looked, newlib
> does not provide.


Thanks!

-- 
Vasiliy Tolstov,
e-mail: v.tols...@selfip.ru

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


Re: [go-nuts] static compile binary with newlib instead of glibc

2017-03-17 Thread Ian Lance Taylor
On Fri, Mar 17, 2017 at 2:03 AM, Vasiliy Tolstov  wrote:
> Does it possible to compile using newlib
> (https://sourceware.org/newlib/) for static binary? Does someone try
> to do that ?

Go can statically link a binary without any C library at all.  The
question of using a C library only comes in when cgo to call C code.
I suspect that right now Go programs that use cgo will fail to build
with newlib, because the runtime/cgo package expects to be able to
call functions like pthread_create that, last time I looked, newlib
does not provide.

Ian

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


Re: [go-nuts] Go Dev Sessions at Google I/O 2017

2017-03-17 Thread Ian Lance Taylor
On Fri, Mar 17, 2017 at 12:01 AM, Nyah Check  wrote:
>
> I don't know for sure how the Google I/O 2017 is going to be like. I just
> wish to ask the Go language Devs if there's going to be any sessions at
> Google I/O this year specific to Go Development or should we look forward
> only to Kubernetes sessions?

I don't think we know either.  At least, I don't know.

Ian

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


Re: [go-nuts] uint type safety in go

2017-03-17 Thread Ian Lance Taylor
On Thu, Mar 16, 2017 at 11:04 PM, Konstantin Khomoutov
 wrote:
> On Tue, 14 Mar 2017 07:12:01 -0700
> Ian Lance Taylor  wrote:
>
>> > I was thinking about the type safety of uint in go, and comparing
>> > it for a similar problem.
>> >
>> > If I have this go code:
>> >
>> > var x uint
>> > x--
>> >
>> > The value of x is then the maximal value of uint, which is probably
>> > not what the gother wanted (I think, is there any particular use
>> > cases for that that you know of?)
>> >
>> > So my question is: why does go allow that, and for example panics
>> > on index out of range of an array? Doesn't it make sense that it
>> > also should panic in this case?
>>
>> Well, there are also uses for modulo arithmetic.  If we make this
>> panic, writing the equivalent operation that doesn't panic seems
>> awkward.  I think there is a better case to be made that signed types
>> should panic on overflow, the main question there being the run time
>> efficiency cost.
>
> I think I might have asked this already but wouldn't it be possible to
> add (in the future) a two-argument form for integer arithmetic
> operations and bit shifts, so that the second argument, if used, is set
> to the overflow status?
>
> Like in:
>
>   var x uint
>   if x, of := x-1; of {
>  panic("Integer underflow");
>   }
>
>   var y uint32
>   if y, cf := x << 33; cf {
>  panic("Bit carrying detected");
>   }
>
> I'm not too much versed in CPU hardware, so offhand I can only say that
> Z80 and x86 do support overflow and carrying detection.

See https://golang.org/issue/6815.

Ian

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


[go-nuts] Live video streaming with Go

2017-03-17 Thread bulat . shamsutdinov
Hello everyone!

Can someone please suggest a general direction to look at to implement 
video streaming server (as simple as possible) in Go?

I'm familiar with go, made some web apps. And now there is a need to make a 
small live video streaming service, that I would love to do in Go.

There is no need to support huge numbers of users, it ain't gonna be 
twitch, just basic functionality like a webcam/screen capture steaming to 
several (maybe hundreds tops) web clients.

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


[go-nuts] Re: Need suggestion for bad code of reflection (using FieldByNameFunc and FieldByName inside it)

2017-03-17 Thread nvcnvn
Hi, its me again. I need some time to prepare what I doing.

I'm using gorp package for matching struct field and db returned column.
After doing pprof I found that a function is particular slow because to 
many reflect.Type.FieldByName called inside a reflect.Type.FieldByNameFunc
So this is what I change for 
returned https://github.com/go-gorp/gorp/pull/347
Put I think I can avoid using FieldByNameFunc by using NumField() and 
recursive for anonymous field for comparing but I not really sure if it 
will be the better trade.  

On Thursday, March 16, 2017 at 3:30:14 PM UTC+7, Ingo Oeser wrote:
>
> What checks are you doing on struct field names and tags? That will be 
> crucial to answering your question.

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


[go-nuts] static compile binary with newlib instead of glibc

2017-03-17 Thread Vasiliy Tolstov
Does it possible to compile using newlib
(https://sourceware.org/newlib/) for static binary? Does someone try
to do that ?

-- 
Vasiliy Tolstov,
e-mail: v.tols...@selfip.ru

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


[go-nuts] Go Dev Sessions at Google I/O 2017

2017-03-17 Thread Nyah Check
Hi Gophers,

I don't know for sure how the Google I/O 2017 is going to be like. I just
wish to ask the Go language Devs if there's going to be any sessions at
Google I/O this year specific to Go Development or should we look forward
only to Kubernetes sessions?

Thanks,
Nyah
-- 
"The heaviest penalty for declining to rule is to be ruled by someone
inferior to yourself." --*Plato*

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


[go-nuts] usql 0.2.0 release

2017-03-17 Thread Kenneth Shaw
Hi all,

Just wanted to announce the release of usql 0.2.0, the universal 
command-line client for SQL databases. Binaries are available for download 
here: https://github.com/knq/usql/releases

Or, install the usual Go way:

go get -u github.com/knq/usql

I've significantly fixed how input is handled, and it is quickly coming up 
to par with PostgreSQL's psql. While there are still a bunch of missing 
command lines, many of the basic (non-introspection) backslash (ie \g \p \e 
etc) meta commands have been implemented. Documentation is non-existent at 
the moment, but anyone familiar with psql should feel at home when using 
usql now.

Additionally, support has been added for ADODB (Windows only).

Stay tuned -- a lot of really awesome features are coming up, including:

Google Spanner support
Syntax highlighting
Completion
Greater psql compatibility

For the record, the databases currently tested and supported by usql out of 
the box:

PostgreSQL
MySQL (and variants)
Microsoft SQL Server
Oracle Database
SQLite3
SAP HANA
Microsoft ADODB (OLE)

Also, I'd really appreciate it if people could get out there and test 
usql's new input handling with more "real" SQL schemas/queries/workloads, 
and report any issues encountered (if any) to the GitHub issues page. 
Additionally, pull requests are always welcome!

Cheers,

-Ken

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


Re: [go-nuts] uint type safety in go

2017-03-17 Thread Konstantin Khomoutov
On Tue, 14 Mar 2017 07:12:01 -0700
Ian Lance Taylor  wrote:

> > I was thinking about the type safety of uint in go, and comparing
> > it for a similar problem.
> >
> > If I have this go code:
> >
> > var x uint
> > x--
> >
> > The value of x is then the maximal value of uint, which is probably
> > not what the gother wanted (I think, is there any particular use
> > cases for that that you know of?)
> >
> > So my question is: why does go allow that, and for example panics
> > on index out of range of an array? Doesn't it make sense that it
> > also should panic in this case?
> 
> Well, there are also uses for modulo arithmetic.  If we make this
> panic, writing the equivalent operation that doesn't panic seems
> awkward.  I think there is a better case to be made that signed types
> should panic on overflow, the main question there being the run time
> efficiency cost.

I think I might have asked this already but wouldn't it be possible to
add (in the future) a two-argument form for integer arithmetic
operations and bit shifts, so that the second argument, if used, is set
to the overflow status?

Like in:

  var x uint
  if x, of := x-1; of {
 panic("Integer underflow");
  }

  var y uint32
  if y, cf := x << 33; cf {
 panic("Bit carrying detected");
  }

I'm not too much versed in CPU hardware, so offhand I can only say that
Z80 and x86 do support overflow and carrying detection.

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