Re: [go-nuts] Re: iconvg: a compact, binary format for simple vector graphics

2016-10-25 Thread Nigel Tao
On Wed, Oct 26, 2016 at 12:45 AM, Sean Russell  wrote:
> How did you calculate the SVG sizes?  When I download the the icons from the
> material design github, the collection of the *_48px.svg icons weighs in at
> 3.8MB.

You may be double counting the design/ and production/ versions of the
same icons, although that shouldn't explain a 10x difference. There
may be other factors. How did you make your calculation?


> So, one question and one suggestion: the question is what were you measuring
> for the SVG size, and the comment is that you might want to address the svgz
> aspect.  As in, "yes, svgz is smaller, but more expensive to decode," with
> benchmarks, or whatever other technical merits you're aware of.

The SVG size was measured by this program:
https://go.googlesource.com/exp/+/master/shiny/materialdesign/icons/gen.go
which generated this file (look at the final lines):
https://go.googlesource.com/exp/+/master/shiny/materialdesign/icons/data.go

SVGZ is indeed smaller, and more expensive to decode, but I don't have
numbers at hand.

Even so, there's still the point that a spec-compliant SVG renderer is
a _lot_ of code, and XML brings its own complexities.

-- 
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] iconvg: a compact, binary format for simple vector graphics

2016-10-25 Thread Nigel Tao
On Tue, Oct 25, 2016 at 9:30 PM, roger peppe  wrote:
> Would there be some advantage in making the Rasterizer
> types in shiny/iconvg and image/vector somewhat more
> uniform in the types they use? For example, vector.Rasterizer
> seems to use f32.Vec2 pairs everywhere, but iconvg.Rasterizer
> uses individual x, y arguments.

Yeah, it might be nicer for image/vector to take (bx, by float32)
instead of (b f32.Vec2). Let me think about it.


> How feasible would it be (if at all) to translate from iconvg format
> to svg format?

>From IconVG to SVG should be trivial, other than features SVG doesn't
have (I think) such as Level-Of-Detail culling.

-- 
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] Freetype performance

2016-10-25 Thread Nigel Tao
On Tue, Oct 25, 2016 at 9:40 PM, David M.  wrote:
> Is the Go freetype library optimized? Should I expect a similar performance
> from the original C version? Why freetype don't use an internal cache to
> store most frequent characters?

Go freetype has had some performance work, but not a lot.

I don't have any hard data, but I'd expect it to be e.g. within 2x
worse of the original C version, but not as bad as than 10x worse.

Go freetype should use an internal cache for glyph image masks. Do you
have evidence that this cache is not being used?

Can you link to your code?

The https://blog.golang.org/profiling-go-programs blog post is a
little old, but it should still give some leads on how to profile your
Go code at the function level, not just a coarse "70 fps" number.

-- 
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] cross-compile with cgo 'permission denied'

2016-10-25 Thread Pietro Gagliardi
What part of that magic incantation was not documented?
> On Oct 25, 2016, at 5:23 PM, Liam  wrote:
> 
> What I wanted was the magic incantation (documented nowhere) for linux_arm 
> installation:
> 
>GOOS=linux GOARCH=arm CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc go install 
> -v -a std
>GOOS=linux GOARCH=arm CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc go install 
> -v -a cmd
> 
> where CC varies for the toolchain installed.
> 
> Would the maintainers mind if I filed an issue for this under the docs tag?
> 
> 
> On Tuesday, October 25, 2016 at 11:13:47 AM UTC-7, Dave Cheney wrote:
> Unless you have built Go from source and/or your user owns the path Go is 
> installed in, this is one of the few cases where go build is recommended over 
> go install. 
> 
> http://dave.cheney.net/2015/08/22/cross-compilation-with-go-1-5 
> 
> 
> On Wednesday, 26 October 2016 05:09:18 UTC+11, Liam wrote:
> I have these commands in a package script:
> 
>   GOPATH="${srcdir}" go get -d -u "${_site}/${pkgname}"
>   ...
>   GOPATH="${srcdir}" GOOS=linux GOARCH=arm \
>   CC=arm-unknown-linux-gnueabihf-gcc CGO_ENABLED=1 \
>   go install -v -ldflags='-s -w -extld=$CC' "${_site}/${pkgname}"
> 
> Results:
> 
>   runtime/cgo
>   go install runtime/cgo: open /usr/lib/go/pkg/linux_arm/runtime/cgo.a: 
> permission denied
> 
> My cgo.a files have very diff sizes:
> 
>   $ ls -l /lib/go/pkg/*/runtime/cgo*
>   -rw-r--r-- 1 root root 64874 Sep  8 00:13 
> /lib/go/pkg/linux_amd64/runtime/cgo.a
>   -rw-r--r-- 1 root root 65054 Sep  8 00:18 
> /lib/go/pkg/linux_amd64_race/runtime/cgo.a
>   -rw-r--r-- 1 root root  2642 Oct 25 03:54 
> /lib/go/pkg/linux_arm/runtime/cgo.a
> 
> I have rebuilt for linux_arm:
> 
>GOOS=linux GOARCH=arm go install -v -a std
>GOOS=linux GOARCH=arm go install -v -a cmd
> 
> On Arch Linux x86_64 with go1.7.1 linux/amd64
> 
> 
> -- 
> 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.


Re: [go-nuts] Re: cross-compile with cgo 'permission denied'

2016-10-25 Thread Ian Lance Taylor
On Tue, Oct 25, 2016 at 2:23 PM, Liam  wrote:
> What I wanted was the magic incantation (documented nowhere) for linux_arm
> installation:
>
>GOOS=linux GOARCH=arm CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc go install
> -v -a std
>GOOS=linux GOARCH=arm CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc go install
> -v -a cmd
>
> where CC varies for the toolchain installed.
>
> Would the maintainers mind if I filed an issue for this under the docs tag?

Even better than an issue would be a change (see
https://golang.org/doc/contribute.html).  But an issue is still OK,
but please tell us where it should be documented.  That is, where did
you look?  Where would you expect to find this?

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] Re: go get: You are not currently on a branch

2016-10-25 Thread Thomas Modeneis
gurp...@gmail.com wrote:
"The error occurs because the repo got a new branch since your last go 
get." 

...right ... but look how many errors, one have to manually get "fixed" in 
order get a dependency updated.

$ go get -u github.com/dancannon/gorethink
# cd /opt/gocode/src/github.com/Sirupsen/logrus; git pull --ff-only
>From https://github.com/Sirupsen/logrus
   08a8a7c..3ec0642  master -> origin/master
You are not currently on a branch. Please specify which
branch you want to merge with. See git-pull(1) for details.

git pull  

package github.com/Sirupsen/logrus: exit status 1
# cd /opt/gocode/src/github.com/cenk/backoff; git pull --ff-only
>From https://github.com/cenk/backoff
   cdf48bb..b02f2bb  master -> origin/master
You are not currently on a branch. Please specify which
branch you want to merge with. See git-pull(1) for details.

git pull  

package github.com/cenk/backoff: exit status 1
# cd /opt/gocode/src/github.com/hailocab/go-hostpool; git pull --ff-only
You are not currently on a branch. Please specify which
branch you want to merge with. See git-pull(1) for details.

git pull  

package github.com/hailocab/go-hostpool: exit status 1
# cd /opt/gocode/src/gopkg.in/dancannon/gorethink.v2; git pull --ff-only
>From https://gopkg.in/dancannon/gorethink.v2
   e75f34b..016a1d3  master -> origin/master
   b2c14ad..016a1d3  develop-> origin/develop
 * [new tag] v2.2.2 -> v2.2.2
>From https://gopkg.in/dancannon/gorethink.v2
 * [new tag] v2.2.1 -> v2.2.1
You are not currently on a branch. Please specify which
branch you want to merge with. See git-pull(1) for details.

git pull  

package gopkg.in/dancannon/gorethink.v2/encoding: exit status 1
# cd /opt/gocode/src/gopkg.in/fatih/pool.v2; git pull --ff-only
You are not currently on a branch. Please specify which
branch you want to merge with. See git-pull(1) for details.

git pull  

package gopkg.in/fatih/pool.v2: exit status 1

 

On Friday, October 14, 2016 at 6:17:14 PM UTC+2, gurp...@gmail.com wrote:
>
>  cd $GOPATH/src/github.com/mattn/go-sqlite3; git pull --ff-only origin 
> master
>
> Add `origin master` suffix to the command suggested by the error. (master 
> or otherwise)
>
> The error occurs because the repo got a new branch since your last go get.
>
> On Saturday, May 28, 2016 at 11:12:27 PM UTC+5:30, Tong Sun wrote:
>>
>> How to fix the "You are not currently on a branch" error for `go get`?
>>
>> $ go get -u github.com/mattn/go-sqlite3
>> # cd .../src/github.com/mattn/go-sqlite3; git pull --ff-only
>> From https://github.com/mattn/go-sqlite3
>>  * [new branch]  gh-pages   -> origin/gh-pages
>>bbd33c0..38ee283  master -> origin/master
>>  * [new branch]  systemlib  -> origin/systemlib
>>  * [new tag] v1.0.0 -> v1.0.0
>>  * [new tag] v1.1.0 -> v1.1.0
>> You are not currently on a branch.
>> Please specify which branch you want to merge with.
>> See git-pull(1) for details.
>>
>> git pull  
>>
>> package github.com/mattn/go-sqlite3: exit status 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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: [ANN] AXIS VFS - Simple, lightweight, virtual file system API

2016-10-25 Thread milo . christiansen
// From the code to initialize AXIS in Rubble
fs := new(axis2.FileSystem)

fs.Mount("df", sources.NewOSDir(dfdir), true)
fs.Mount("rubble", sources.NewOSDir(rubbledir), true)
fs.Mount("out", sources.NewOSDir(output), true)
for i := range addonsdir {
fs.Mount("addons", sources.NewOSDir(addonsdir[i]), true)
}

// From part of the Rubble addon loader (mount and read from a zip file)
content, err := fs.ReadAll("addons/"+name+".zip")
if err != nil {
errors.RaiseWrappedError("While reading zip file:", err)
}

ds, err = zip.NewRawDir(content)
if err != nil {
errors.RaiseWrappedError("While reading zip file:", err)
}

fs.Mount("loader/pack", ds, false)
meta = loadPackMeta(fs, "loader/pack")
fs.Unmount("loader/pack", true)

// More code from the loader
for _, filepath := range fs.ListFiles(dirpath) {
content, err := fs.ReadAll(path+filepath)
if err != nil {
panic(err)
}

...
}

Have some random excerpts from Rubble (the main client for AXIS right now). 
Obviously there are just code snippets, but they should be helpful. I'll 
write some proper examples for the package sooner or later...

On Friday, October 21, 2016 at 4:20:15 PM UTC-4, milo.chr...@gmail.com 
wrote:
>
> AXIS VFS public repository 
>
> Today I am proud to announce the public release of AXIS VFS, a simple and 
> lightweight virtual file system API. AXIS' intended purpose is to abstract 
> file IO so that the client program does not need to know anything about the 
> system it is running on and to allow files from dissimilar sources to be 
> read with a unified API.
>
> I personally use AXIS in a data file loader to support multiple source 
> directories and loading from zip files, but this API has many other uses.
>
> I hope you will find this simple little library useful!
>

-- 
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: [ANN] AXIS VFS - Simple, lightweight, virtual file system API

2016-10-25 Thread ChrisLu
Need some examples to understand the API.

Chris

On Friday, October 21, 2016 at 1:20:15 PM UTC-7, milo.chr...@gmail.com 
wrote:
>
> AXIS VFS public repository 
>
> Today I am proud to announce the public release of AXIS VFS, a simple and 
> lightweight virtual file system API. AXIS' intended purpose is to abstract 
> file IO so that the client program does not need to know anything about the 
> system it is running on and to allow files from dissimilar sources to be 
> read with a unified API.
>
> I personally use AXIS in a data file loader to support multiple source 
> directories and loading from zip files, but this API has many other uses.
>
> I hope you will find this simple little library useful!
>

-- 
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: cross-compile with cgo 'permission denied'

2016-10-25 Thread Dave Cheney
Unless you have built Go from source and/or your user owns the path Go is 
installed in, this is one of the few cases where go build is recommended 
over go install. 

http://dave.cheney.net/2015/08/22/cross-compilation-with-go-1-5

On Wednesday, 26 October 2016 05:09:18 UTC+11, Liam wrote:
>
> I have these commands in a package script:
>
>   GOPATH="${srcdir}" go get -d -u "${_site}/${pkgname}"
>   ...
>   GOPATH="${srcdir}" GOOS=linux GOARCH=arm \
>   CC=arm-unknown-linux-gnueabihf-gcc CGO_ENABLED=1 \
>   go install -v -ldflags='-s -w -extld=$CC' "${_site}/${pkgname}"
>
>
> Results:
>
>   runtime/cgo
>   go install runtime/cgo: open /usr/lib/go/pkg/linux_arm/runtime/cgo.a: 
> permission denied
>
>
> My cgo.a files have very diff sizes:
>
>   $ ls -l /lib/go/pkg/*/runtime/cgo*
>   -rw-r--r-- 1 root root 64874 Sep  8 00:13 
> /lib/go/pkg/linux_amd64/runtime/cgo.a
>   -rw-r--r-- 1 root root 65054 Sep  8 00:18 
> /lib/go/pkg/linux_amd64_race/runtime/cgo.a
>   -rw-r--r-- 1 root root  2642 Oct 25 03:54 
> /lib/go/pkg/linux_arm/runtime/cgo.a
>
>
> I have rebuilt for linux_arm:
>
>GOOS=linux GOARCH=arm go install -v -a std
>GOOS=linux GOARCH=arm go install -v -a cmd
>
> On Arch Linux x86_64 with go1.7.1 linux/amd64
>
>

-- 
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] cross-compile with cgo 'permission denied'

2016-10-25 Thread Liam
I have these commands in a package script:

  GOPATH="${srcdir}" go get -d -u "${_site}/${pkgname}"
  ...
  GOPATH="${srcdir}" GOOS=linux GOARCH=arm \
  CC=arm-unknown-linux-gnueabihf-gcc CGO_ENABLED=1 \
  go install -v -ldflags='-s -w -extld=$CC' "${_site}/${pkgname}"


Results:

  runtime/cgo
  go install runtime/cgo: open /usr/lib/go/pkg/linux_arm/runtime/cgo.a: 
permission denied


My cgo.a files have very diff sizes:

  $ ls -l /lib/go/pkg/*/runtime/cgo*
  -rw-r--r-- 1 root root 64874 Sep  8 00:13 
/lib/go/pkg/linux_amd64/runtime/cgo.a
  -rw-r--r-- 1 root root 65054 Sep  8 00:18 
/lib/go/pkg/linux_amd64_race/runtime/cgo.a
  -rw-r--r-- 1 root root  2642 Oct 25 03:54 /lib/go/pkg/linux_arm/runtime/cgo.a


I have rebuilt for linux_arm:

   GOOS=linux GOARCH=arm go install -v -a std
   GOOS=linux GOARCH=arm go install -v -a cmd

On Arch Linux x86_64 with go1.7.1 linux/amd64

-- 
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: [ANN] DCLua - Lua 5.3 VM and compiler for Go

2016-10-25 Thread milo . christiansen
I don't have any number currently, and I no longer have the other VMs I 
tested installed any more. There is a disabled "benchmark" included in the 
package that will run a chunk of code in both my VM and the fastest of the 
ones I tested. If I remember correctly it was measurably slower, but well 
within an order of magnitude. Sometime I need to sit down and do some 
optimizing...

On Tuesday, October 25, 2016 at 12:58:12 PM UTC-4, milo.chr...@gmail.com 
wrote:
>
>
> GitHub Repository 
>
> DCLua is a lightweight Lua 5.3 VM and compiler for embedding in Go 
> programs. Most of the Lua standard library is implemented, the exceptions 
> are due to implementation details, security, and just plain laziness... 
>
>
> AFAIK there are two other pure-Go Lua VMs available, one is for 5.1, and 
> the other for 5.2. This VM is slightly slower than both the alternatives (I 
> haven't optimized it at all), but the one has next to no documentation and 
> the other is extremely buggy. My VM is stable, documented, and easy to use.
>
> Have fun!
>

-- 
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: [ANN] DCLua - Lua 5.3 VM and compiler for Go

2016-10-25 Thread chris.lu via golang-nuts
Thanks! I will try to use it in my project, which is a map reduce system in 
pure Go. But the computation is in Lua. Currently it support calling Luajit 
via an external OS process.

https://github.com/chrislusf/gleam

Maybe you can also post some perf numbers?

Chris

On Tuesday, October 25, 2016 at 9:58:12 AM UTC-7, milo.chr...@gmail.com 
wrote:
>
>
> GitHub Repository 
>
> DCLua is a lightweight Lua 5.3 VM and compiler for embedding in Go 
> programs. Most of the Lua standard library is implemented, the exceptions 
> are due to implementation details, security, and just plain laziness... 
>
>
> AFAIK there are two other pure-Go Lua VMs available, one is for 5.1, and 
> the other for 5.2. This VM is slightly slower than both the alternatives (I 
> haven't optimized it at all), but the one has next to no documentation and 
> the other is extremely buggy. My VM is stable, documented, and easy to use.
>
> Have fun!
>

-- 
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: Survey on Software Architectures

2016-10-25 Thread paraiso . marc
I'm on page 5 of the survey and still didn't get any question regarding 
software modelling. I stopped answering these questions.

I'm not keen of survey methodology but I don't think most questions are 
relevant to the theme of the survey. I also think you should ask personal 
questions 
at the end of the survey instead of the beginning as I don't think my 
country of origin, age or education influences how you build questions 
about the core theme of that survey. It would yield much more results.

Le mardi 25 octobre 2016 16:31:07 UTC+2, ozkaya...@gmail.com a écrit :
>
> Dear All,
> We're conducting a survey on software architecture modelling whose link is 
> http://bit.ly/2bGpSN4
> The survey aims at better understanding the practical knowledge and 
> experience of practitioners on software architecture modelling languages.
> If you spend 3-7 mins to fill the  survey, we would be so grateful to you. 
> Indeed, we imperatively need participants to contribute our research on 
> software architectures.
> If you know any potential participants, would you mind me requesting you 
> to forward to survey to them?
> Best,Mert
>

-- 
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] DCLua - Lua 5.3 VM and compiler for Go

2016-10-25 Thread milo . christiansen

GitHub Repository 

DCLua is a lightweight Lua 5.3 VM and compiler for embedding in Go 
programs. Most of the Lua standard library is implemented, the exceptions 
are due to implementation details, security, and just plain laziness... 


AFAIK there are two other pure-Go Lua VMs available, one is for 5.1, and 
the other for 5.2. This VM is slightly slower than both the alternatives (I 
haven't optimized it at all), but the one has next to no documentation and 
the other is extremely buggy. My VM is stable, documented, and easy to use.

Have fun!

-- 
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: Is it possible to enable http2 and have specific TLS configuration?

2016-10-25 Thread Dave Cheney
You have to depend on golang.org/x/net/http2 to opt in 

https://github.com/davecheney/httpstat/blob/master/main.go#L252

On Wednesday, 26 October 2016 03:46:31 UTC+11, Moshe Litvin wrote:
>
> The code in net/http/transport.go (onceSetNextProtoDefaults) contain:
>
>  if t.TLSClientConfig != nil || t.Dial != nil || t.DialTLS != nil {
>  // Be conservative and don't automatically enable
>  // http2 if they've specified a custom TLS config or
>  // custom dialers. Let them opt-in themselves via
>  // http2.ConfigureTransport so we don't surprise them
>  // by modifying their tls.Config. Issue 14275.
>  return
>  }
>
>
> Stating that if you did something non-standard in the dialer or TLS you 
> don't get http2 by default.
>
> But the suggested opt-in methods does not exist (was replace by the 
> non-public http2ConfigureTransport.
>
> The net/http documentation only specify opting out, but is there a way to 
> opt-in?
>
> Moshe
>

-- 
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] Is it possible to enable http2 and have specific TLS configuration?

2016-10-25 Thread Moshe Litvin
The code in net/http/transport.go (onceSetNextProtoDefaults) contain:

 if t.TLSClientConfig != nil || t.Dial != nil || t.DialTLS != nil {
 // Be conservative and don't automatically enable
 // http2 if they've specified a custom TLS config or
 // custom dialers. Let them opt-in themselves via
 // http2.ConfigureTransport so we don't surprise them
 // by modifying their tls.Config. Issue 14275.
 return
 }


Stating that if you did something non-standard in the dialer or TLS you 
don't get http2 by default.

But the suggested opt-in methods does not exist (was replace by the 
non-public http2ConfigureTransport.

The net/http documentation only specify opting out, but is there a way to 
opt-in?

Moshe

-- 
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] Hosting godoc internally for private git server

2016-10-25 Thread Kareem Gan
Ah. But I need it to download the repositories from my organizations
enterprise github server through.
On Tue, Oct 25, 2016 at 09:55 Pietro Gagliardi  wrote:

> Is imitating golang.org not sufficient? It will still show you all the
> packages in your $GOPATH in the Packages page:
>
> http://imgur.com/EGpqWsR
>
> On Oct 25, 2016, at 10:36 AM, Kareem Gan  wrote:
>
> So it's not possible? It would be really helpful if someone here has done
> it already and share the knowledge how.
>
> On Thursday, October 20, 2016 at 12:35:10 PM UTC-5, Pietro Gagliardi
> (andlabs) wrote:
>
> You can go get golang.org/x/tools/cmd/godoc and run the godoc tool
> itself, which will imitate golang.org. This is different from godoc.org;
> that is harder to host locally.
>
> On Oct 20, 2016, at 1:13 PM, Kareem Gan  wrote:
>
> Hello.
>
> Is it possible to host godoc internally because we have our own git server
> and would like to host godoc internally so we can build documentation for
> our golang repositories.
> --
> Best,
>
> Kareem Gan
> 01010011 01000101
>
> --
> 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...@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.
>
> --
Best,

Kareem Gan
01010011 01000101

-- 
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] Hosting godoc internally for private git server

2016-10-25 Thread Kareem Gan
So it's not possible? It would be really helpful if someone here has done 
it already and share the knowledge how.

On Thursday, October 20, 2016 at 12:35:10 PM UTC-5, Pietro Gagliardi 
(andlabs) wrote:
>
> You can go get golang.org/x/tools/cmd/godoc and run the godoc tool 
> itself, which will imitate golang.org. This is different from godoc.org; 
> that is harder to host locally.
>
> On Oct 20, 2016, at 1:13 PM, Kareem Gan  
> wrote:
>
> Hello.
>
> Is it possible to host godoc internally because we have our own git server 
> and would like to host godoc internally so we can build documentation for 
> our golang repositories.
> -- 
> Best,
>
> Kareem Gan
> 01010011 01000101
>
> -- 
> 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...@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] I can't build golang

2016-10-25 Thread voxsim
I can't build golang due to cycle problem.

### What version of Go are you using (`go version`)?
The version on my pc is go version go1.7.1 darwin/amd64, but i downloaded a 
fresh version from git.

### What operating system and processor architecture are you using (`go 
env`)?
 ```
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/voxsim/Projects/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.7.1/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.7.1/libexec/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments 
-fmessage-length=0 
-fdebug-prefix-map=/var/folders/bt/fmr6z5wx2b9b2x9w51y2m_30gn/T/go-build667588921=/tmp/go-build
 
-gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
 ```

### my env variables
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.dJIR793aPj/Render
COLORFGBG=7;0
ITERM_PROFILE=Default
XPC_FLAGS=0x0
PWD=/Users/voxsim/Projects/go/src
SHELL=/bin/zsh
SECURITYSESSIONID=186ee
TERM_PROGRAM_VERSION=3.0.10
TERM_PROGRAM=iTerm.app
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/voxsim/.bin:/Users/voxsim/gopath/bin
COMMAND_MODE=unix2003
TERM=xterm-256color
HOME=/Users/voxsim
TMPDIR=/var/folders/bt/fmr6z5wx2b9b2x9w51y2m_30gn/T/
USER=voxsim
XPC_SERVICE_NAME=0
LOGNAME=voxsim
ITERM_SESSION_ID=w0t2p1:22F762D5-BC47-4939-B825-1E5B2A641E1F
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
SHLVL=1
OLDPWD=/Users/voxsim/Projects/go
ZSH=/Users/voxsim/.oh-my-zsh
GOPATH=/Users/voxsim/gopath
EDITOR=nvim
DISABLE_AUTO_TITLE=true
PAGER=less
LESS=-R
LSCOLORS=Gxfxcxdxbxegedabagacad
ZSH_TMUX_TERM=screen-256color
_ZSH_TMUX_FIXED_CONFIG=/Users/voxsim/.oh-my-zsh/plugins/tmux/tmux.extra.conf
LC_CTYPE=UTF-8
_=/usr/bin/env

### What did you do?
After I checkout the project in ~/Projects/go e I read 
[here](https://golang.org/doc/contribute.html).
 ```
I setted GOROOT_BOOTSTRAP to /usr/local because my go installation is in 
/usr/local/bin/go:
export GOROOT_BOOTSTRAP=/usr/local
./all.bash
 ```

First result:
 ```
# Building Go bootstrap tool.
cmd/dist
cmd/dist/build.go:8:2: cannot find package "bytes" in any of:
/usr/local/src/bytes (from $GOROOT)
/Users/voxsim/gopath/src/bytes (from $GOPATH)
cmd/dist/build.go:9:2: cannot find package "encoding/json" in any of:
/usr/local/src/encoding/json (from $GOROOT)
/Users/voxsim/gopath/src/encoding/json (from $GOPATH)
cmd/dist/test.go:9:2: cannot find package "errors" in any of:
/usr/local/src/errors (from $GOROOT)
/Users/voxsim/gopath/src/errors (from $GOPATH)
cmd/dist/build.go:10:2: cannot find package "flag" in any of:
/usr/local/src/flag (from $GOROOT)
/Users/voxsim/gopath/src/flag (from $GOPATH)
cmd/dist/build.go:11:2: cannot find package "fmt" in any of:
/usr/local/src/fmt (from $GOROOT)
/Users/voxsim/gopath/src/fmt (from $GOPATH)
cmd/dist/util.go:10:2: cannot find package "io" in any of:
/usr/local/src/io (from $GOROOT)
/Users/voxsim/gopath/src/io (from $GOPATH)
cmd/dist/test.go:12:2: cannot find package "io/ioutil" in any of:
/usr/local/src/io/ioutil (from $GOROOT)
/Users/voxsim/gopath/src/io/ioutil (from $GOPATH)
cmd/dist/test.go:13:2: cannot find package "log" in any of:
/usr/local/src/log (from $GOROOT)
/Users/voxsim/gopath/src/log (from $GOPATH)
cmd/dist/build.go:12:2: cannot find package "os" in any of:
/usr/local/src/os (from $GOROOT)
/Users/voxsim/gopath/src/os (from $GOPATH)
cmd/dist/build.go:13:2: cannot find package "os/exec" in any of:
/usr/local/src/os/exec (from $GOROOT)
/Users/voxsim/gopath/src/os/exec (from $GOPATH)
cmd/dist/build.go:14:2: cannot find package "path/filepath" in any of:
/usr/local/src/path/filepath (from $GOROOT)
/Users/voxsim/gopath/src/path/filepath (from $GOPATH)
cmd/dist/test.go:17:2: cannot find package "regexp" in any of:
/usr/local/src/regexp (from $GOROOT)
/Users/voxsim/gopath/src/regexp (from $GOPATH)
cmd/dist/util.go:15:2: cannot find package "runtime" in any of:
/usr/local/src/runtime (from $GOROOT)
/Users/voxsim/gopath/src/runtime (from $GOPATH)
cmd/dist/build.go:15:2: cannot find package "sort" in any of:
/usr/local/src/sort (from $GOROOT)
/Users/voxsim/gopath/src/sort (from $GOPATH)
cmd/dist/main.go:11:2: cannot find package "strconv" in any of:
/usr/local/src/strconv (from $GOROOT)
/Users/voxsim/gopath/src/strconv (from $GOPATH)
cmd/dist/build.go:16:2: cannot find package "strings" in any of:
/usr/local/src/strings (from $GOROOT)
/Users/voxsim/gopath/src/strings (from $GOPATH)
cmd/dist/build.go:17:2: cannot find package "sync" in any of:
/usr/local/src/sync (from $GOROOT)
/Users/voxsim/gopath/src/sync (from $GOPATH)
cmd/dist/test.go:21:2: cannot find package "time" in any of:
/usr/local/src/time (from $GOROOT)
/Users/voxsim/gopath/src/time (from $GOPATH)
 ```

I setted the GOPATH to the project:
 ```
export GOPATH=~/Projects/go
./all.bash
 ```

second result:
 ```
cmd/dist
import cycle not allowed
package cmd/dist
imports bytes
imports errors
imports runtime
imports runtime/internal/atomic

[go-nuts] Survey on Software Architectures

2016-10-25 Thread ozkaya . mert . 1
Dear All,
We're conducting a survey on software architecture modelling whose link is 
http://bit.ly/2bGpSN4
The survey aims at better understanding the practical knowledge and 
experience of practitioners on software architecture modelling languages.
If you spend 3-7 mins to fill the  survey, we would be so grateful to you. 
Indeed, we imperatively need participants to contribute our research on 
software architectures.
If you know any potential participants, would you mind me requesting you to 
forward to survey to them?
Best,Mert

-- 
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: do i need to wait all child routine exit

2016-10-25 Thread Nick Patavalis


On Tuesday, October 25, 2016 at 5:17:10 PM UTC+3, Axel Wagner wrote:
>
> I suggest using errgroup 
>  (and/or context.Context  in 
> general) instead of rolling your own cancellation and timeout logic. It 
> should make it pretty much trivial to kick off all the queries and cancel 
> the context once you got the first result. It will also allow you to 
> propagate that cancellation seamlessly through the ecosystem (e.g. 
> cancellation traverses network boundaries when used with grpc and it will 
> kill child processes if they are spawned with a context 
> ). The errgroup documentation 
> has specific examples for how to do this kind of thing.
>

Yes using context.Context for cancelation would be even better.
  

-- 
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] XML parsing of simple array of tags

2016-10-25 Thread Ken MacDonald
Hi Kiki,
Thanks - the first part did the trick! I'd have posted what I had tried,
except that I tried probably a dozen variations on different themes, and
can't even remember them all Also, appreciate the second part of your
example - that may come up useful someday.

I've got a couple of things I'm trying to do here - mostly trying to get a
number of divergent versions of these XML config files into a canonical
form where I can "diff" them more readily, as some have comments, others
not, etc. Once I get a representation I'm going to filter variant items
that may change such as timestamps, etc. so that they don't "pollute" the
diffs as well.
Ken

On Tue, Oct 25, 2016 at 9:23 AM, Kiki Sugiaman  wrote:

> Does either of the two results from the following code give you what you
> want?
>
> https://play.golang.org/p/Dh1N1xPxiw
>
>
> Btw, it wouldn't hurt posting what you have tried to do if you have tried
> them. It makes it easy for those who want to give you a suggestion :)
>
>
> --
> 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.


Re: [go-nuts] XML parsing of simple array of tags

2016-10-25 Thread Kiki Sugiaman
Does either of the two results from the following code give you what you 
want?


https://play.golang.org/p/Dh1N1xPxiw


Btw, it wouldn't hurt posting what you have tried to do if you have 
tried them. It makes it easy for those who want to give you a suggestion :)


--
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] do i need to wait all child routine exit

2016-10-25 Thread Ken MacDonald
You should not need to wait for more than a single response if any of the
responses will do the job. I've done this querying several distributed DBs
for an answer, and just taking the one that comes back fastest.

On Tue, Oct 25, 2016 at 2:53 AM,  wrote:

> in my case, i have serval child routine for query for dns record, but i
> just need a answer
>
> code looks like:
>
> recvChan := make(chan *dnsRecord, 1)
>
>
> defer close(recvChan)
>
>
>
>
> for _, server := range DnsServers {
>
>
> go doResolve(server, req, recvChan)   // query ip address
>
>
> }
>
>
>
>
> select {
>
>
> case r := <-recvChan:   // receive address
>
>
> responseRecord(w, req, r)  // response to client
>
>
> case <-time.After(2 * time.Second):  // timeout
>
>
> break
>
>
> }
>
> return
>
>
> do i need to wait all child routine exit before return
>
> --
> 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.


Re: [go-nuts] issue with sending JSON via HTTP

2016-10-25 Thread Henrik Johansson
It seems like you encode the valid json string?
If you have a string that is json you should be able to post the string as
is no?

Just make sure you set the application/json content type.

tis 25 okt. 2016 kl 14:32 skrev Rich :

> Hi All,
>
> I have code that is similar to this:
> https://play.golang.org/p/zZ8EQ-R6cb
>
> When I run it I get the following error:
> 2016/10/25 12:19:56 Body: 400 {"message":"The JSON stream reader doesn't
> support chunking."}
>
> So I changed my code to this:
> https://play.golang.org/p/NYV5SdCtnt
>
> and I get the following error:
> 2016/10/25 12:28:28 Body: 400 {"message":"Expecting an array or an
> object."}
>
> This curl command is successful:
> curl -vv -u m11...@myjob.com:mypas$ -H 'Content-Type:application/json' -X
> POST -d @/home/m1/helloworld.json
> http://someupload.myjob.com:8080/events/com.myjob.upload
>
>
> helloworld.json looks like this:
> {
>   "Name": "Operational Demo MR",
>   "greeting": "Hello  World"
> }
>
> I am not sure what it's looking for... any help would be appreciated.
>
>
> --
> 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.


Re: [go-nuts] Profiling live webserver application

2016-10-25 Thread Shawn Milochik
The net/pprof package works great for this. What do you get when you run
one of these?

go tool pprof http://localhost:6060/debug/pprof/profile

or

go tool pprof http://localhost:6060/debug/pprof/heap

You may have to replace port 6060 with the port you're actually listening
on. Once you're in there you can type "web" to get a graphic showing where
your CPU is being used.

If that's not working, perhaps you're capturing the /debug path with one of
your handlers. I recommend running a separate server on port 6060 that only
listens on localhost (for security reasons). Also, you should create a
separate http.Server instance for this. If you're using the default
http.Server in your code, you won't want to mix them, otherwise you could
run into the same collision problem. Plus, you never want your profile info
to be available to the public anyway.

Maybe something like this that you run in a gorouine in your main()
function:


func serveProfiler() {

mux := http.NewServeMux()
profServer := http.Server{
Addr: ":6060",
Handler:  mux,
}

log.Fatalf("failed to start profile server\n",
profServer.ListenAndServe())
}

-- 
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] issue with sending JSON via HTTP

2016-10-25 Thread Rich
Hi All,

I have code that is similar to this:
https://play.golang.org/p/zZ8EQ-R6cb

When I run it I get the following error:
2016/10/25 12:19:56 Body: 400 {"message":"The JSON stream reader doesn't 
support chunking."}

So I changed my code to this:
https://play.golang.org/p/NYV5SdCtnt

and I get the following error:
2016/10/25 12:28:28 Body: 400 {"message":"Expecting an array or an object."}

This curl command is successful:
curl -vv -u m11...@myjob.com:mypas$ -H 'Content-Type:application/json' -X 
POST -d @/home/m1/helloworld.json 
http://someupload.myjob.com:8080/events/com.myjob.upload


helloworld.json looks like this:
{
  "Name": "Operational Demo MR",
  "greeting": "Hello  World"
}

I am not sure what it's looking for... any help would be appreciated. 


-- 
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: Assign a string representation to an enum/const

2016-10-25 Thread yashronaldo07
I tried this thing but it doesn't work. In my example the type for Count is 
displayed as AggregationFuncEnum, but for Sum it is only string.
https://play.golang.org/p/ioemgmE0Sm

On Thursday, November 28, 2013 at 11:52:20 PM UTC+5:30, Rodrigo 
Kochenburger wrote:
>
> I'm gonna second what bronze said. Create a string type and define your 
> constants with that type, but I'd create a more specific meaningful type 
> rather than a generic Enum.
>
> For example:
>
>
> type UserType string
>
> const (
> Admin  UserType = "administrator"
> RegularUser = "regular user"
> .
> )
>
> Note that you only need to define the type for the first const definition 
> in the block.
>
> Hope it helps.
>
> - RK
>
>
> On Thu, Nov 28, 2013 at 3:50 AM, bronze man  > wrote:
>
>> type Enum string
>>
>> const (
>> EnumAbc Enum = "abc"
>> EnumDef Enum = "def"
>> )
>> This type work fine with json.
>>
>>
>> On Thursday, November 28, 2013 5:48:47 PM UTC+8, Péter Szilágyi wrote:
>>>
>>> Hi all,
>>>
>>>   This might be a bit unorthodox question, but I thought I'd ask away 
>>> anyway :D Is there a straightforward possibility to assign string 
>>> representations to an enumeration inline (i.e. at the point of declaring 
>>> the enum), or possibly getting the original source code string back?
>>>
>>>   E.g. I have an enumeration like:
>>>
>>> const (
>>>   Abc = iota
>>>   Def
>>>   Ghi
>>>   Etc
>>> )
>>>
>>>   And during debugging or just logging when I dump my structs containing 
>>> these, I'd like to have a textual representation oppose to an int (mainly 
>>> because I have many tens of entries, and manual lookup is bothersome).
>>>
>>>   Of course, I could map the ints to strings, but I'm wondering if there 
>>> is something simpler, similar to tagging a struct field with a json name... 
>>> i.e.
>>>
>>> type S struct{
>>>   Address string `json:"address"`
>>> }
>>>
>>>   If not, it's not really an issue, I'm just curious :)
>>>
>>> Thanks,
>>>   Peter
>>>
>> -- 
>> 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...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
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] do i need to wait all child routine exit

2016-10-25 Thread dkxulei
in my case, i have serval child routine for query for dns record, but i 
just need a answer

code looks like:

recvChan := make(chan *dnsRecord, 1)


defer close(recvChan)




for _, server := range DnsServers {


go doResolve(server, req, recvChan)   // query ip address


}




select {


case r := <-recvChan:   // receive address


responseRecord(w, req, r)  // response to client


case <-time.After(2 * time.Second):  // timeout


break


}
 
return


do i need to wait all child routine exit before return

-- 
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] XML parsing of simple array of tags

2016-10-25 Thread Ken MacDonald
I'm parsing a fairly large XML stream using "encoding/xml"; most of it 
seems to work fine, but I have a couple of bits like:


4.00
10.00


and:


1
2
3
7
8
10


where I haven't been able extract those values as an array. I would like to 
get the values back as strings, not numerics. I've tried a couple dozen 
things and been spending 
WAY too much time trying to solve this, and haven't found anything in 
previous topics that seem to address this. The main-level items are coming 
back as either completely empty, only getting 1 of the values, or in one 
case, I got an array of garbage chars. Suggestions appreciated!
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] allow {3}, {true} etc

2016-10-25 Thread roger peppe
On 24 October 2016 at 21:14, Nate Finch  wrote:
> Because it's consistent with how you get a pointer for other types... if I'm
> used to using {x} for structs, maps, and slices, then it's perfectly
> natural to try that with builtins and arrays.  If someone says "oh, sorry,
> for ints you have to use ref(5)" then I'm going to get annoyed at an
> inconsistency that seems to exist for no reason.
>
> It's also less likely to overlap with existing code.  A function called ref
> could very well already exist in a current codebase.  But there's likely
> almost no code that uses builtin type names as anything other than the types
> themselves.  And unless you have structs that use builtin type names,
> {5} won't currently compile.

It doesn't really matter if a function called ref is defined already,
as it won't be a problem until you actually want to use it.
(FWIW there are no functions named "ref" in the 1640556
lines of Go code in my GOPATH).

To me the T{...} syntax says "structured type literal" - wrapping
an integer in {} and saying that it's a scalar value seems wrong.

I like "ref" because it involves almost no changes to existing
tooling and it's also useful in other case.

For example, I commonly want to make a shallow copy
of an object. Currently I tend to do this:

func x(t *T) {
t1 := *t
y()
}

but feels a little awkward that t1 is of a different type than T.

func x(t *T) {
t1 := ref(*t)
y(t1)
}

feels a little cleaner.

  cheers,
rog.


>
> On Monday, October 24, 2016 at 3:45:29 PM UTC-4, rog wrote:
>>
>> How would new syntax be better than a built-in function with exactly the
>> semantics you are after and shorter to type to boot?
>>
>>
>> On 23 Oct 2016 01:50, "Nate Finch"  wrote:
>>>
>>> I'd much rather have syntax that just works rather than another built-in
>>> function.
>>>
>>>
>>> On Sat, Oct 22, 2016, 6:17 PM roger peppe  wrote:

 I don't think I'd object if we added a new builtin function called "ref"
 with the above semantics. It worked pretty well in Limbo as an operator.
>
> --
> 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] Freetype performance

2016-10-25 Thread David M.
Hi,

I'm using Go freetype (https://github.com/golang/freetype) for a 3D app 
using OpenGL. At each frame one portion of the text displayed changes, so I 
call DrawString() and upload the new image to OpenGL. After some profiling 
I know that the program runs at 350fps without the DrawString() cost, but 
it goes down to 70 with it. The program is CPU-limited by the freetype 
code. (I checked that the OpenGL upload and draw aren't the bottleneck).

I'm currently using one texture per line of text, and I only call 
DrawString when a line of text is changed. My question is, how can I 
improve the performance of this?

I have some ideas, but I don't like them very much:

   - Using one texture per character instead of per line and cache most 
   characters. In this way DrawString will be only called the first times. 
   However, dealing with this is more complex (kerning) and requires more 
   OpenGL draw calls (1 per character instead of 1 per line).
   - Call DrawString() in a separate goroutine and upload the image to 
   openGL from the main thread after this separated goroutine has completed 
   its work. This should give almost 350fps with texts refreshing at a lower 
   pace. This may work, but it is a work-around after all.

Is the Go freetype library optimized? Should I expect a similar performance 
from the original C version? Why freetype don't use an internal cache to 
store most frequent characters?

-- 
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] iconvg: a compact, binary format for simple vector graphics

2016-10-25 Thread roger peppe
This looks really cool, thanks!

Would there be some advantage in making the Rasterizer
types in shiny/iconvg and image/vector somewhat more
uniform in the types they use? For example, vector.Rasterizer
seems to use f32.Vec2 pairs everywhere, but iconvg.Rasterizer
uses individual x, y arguments.

How feasible would it be (if at all) to translate from iconvg format
to svg format?

  cheers,
rog.

On 24 October 2016 at 07:52, Nigel Tao  wrote:
> I was looking for a compact, binary format for simple vector graphics.
> I didn't find one that did all I wanted.
>
> SVG is the de facto standard for vector graphics, in the open source
> world. Unfortunately, https://www.w3.org/TR/SVG/single-page.html
> prints as 400 pages, not including the XML, CSS or XSLT
> specifications. The S in SVG doesn't stand for simple.
>
> The Haiku Vector Icon Format is pretty close. Unfortunately, I didn't
> find a written specification, only a single C implementation, tightly
> coupled, as far as I could tell, to the Haiku operating system. Also,
> https://www.haiku-os.org/articles/2009-09-14_why_haiku_vector_icons_are_so_small
> says that "you wouldn't really want to use HVIF to store generic
> vector graphics".
>
> OpenType fonts contain vector graphics (glyphs), and people use it for
> icon and emoji fonts. Unfortunately, there doesn't appear to be a
> clear standard for colored or partially transparent glyphs.
> https://en.wikipedia.org/wiki/OpenType#Color lists three competing
> approaches, built on PNG, SVG or neither.
>
> So, as an experiment, I invented a new format: IconVG. The format
> itself is documented at
> https://godoc.org/golang.org/x/exp/shiny/iconvg and there are some
> examples at https://go.googlesource.com/exp/+/master/shiny/iconvg/testdata
>
> The Material Design icon set (https://design.google.com/icons/)
> consists of 961 vector icons. As SVG files, this totals 312,887 bytes.
> As 24*24 pixel PNGs, 190,840 bytes. As 48*48 pixel PNGs, 318,219
> bytes. As IconVGs, 122,012 bytes.
>
> Like all of the golang.org/x/exp/shiny code, this is experimental, but
> I think that IconVG is at an interesting enough point now to share.
>
> The vector rasterizer at golang.org/x/image/vector is also a nice Go
> package, in my biased opinion, based on the algorithm described at
> https://medium.com/@raphlinus/inside-the-fastest-font-renderer-in-the-world-75ae5270c445#.ja3y3m6z2,
> but that's probably a different topic for a different time.
>
> Comments welcome.
>
> --
> 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] Is os.exec thread safe ?

2016-10-25 Thread Dave Cheney
os.Exec is thread safe.

-- 
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] Is os.exec thread safe ?

2016-10-25 Thread Jianjun Mao
Hi all,

I have a HTTP job server which will receive jobs and start them at 
background in another go routine.
A job may run many external commands (e.g. ethtool, supervisorctl ...).
But my server may hang after running a few hours. The server has no log 
output and can't receive any HTTP request.
I have searched a lot, but can only find this 
https://github.com/golang/go/issues/11155.
So my question is that, is os.exec thread safe ? Will it block the 
scheduler ?

-- 
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: iconvg: a compact, binary format for simple vector graphics

2016-10-25 Thread Nigel Tao
On Tue, Oct 25, 2016 at 4:31 PM, Daniel Theophanes  wrote:
> My understanding is that the original rust font render code could replace
> something like FreeType. Do you envision using iconvg and vector as a
> replacement for the go freetype package, where font glyphs would be loaded
> in as iconvg byte streams in a cache and then simply read from there in the
> render loop, resulting in little to no additional allocations or re-parsing
> of the original font glyph?

A TTF parser under golang.org/x/image, using x/image/vector directly
without going through an iconvg middleman, is on my list of things to
do, but one thing at a time...

-- 
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] iconvg: a compact, binary format for simple vector graphics

2016-10-25 Thread Nigel Tao
On Tue, Oct 25, 2016 at 2:13 AM, Pietro Gagliardi  wrote:
> I wonder if there's a way to simulate elliptical gradients with only circular 
> gradients and affine transformations, so package ui can also render these 
> files directly using the system native vector graphics APIs.

I'd expect that you can, but I haven't done it myself.


> Does this also require the cairo/Quartz feature of having a circular gradient 
> have an inner circle and an outer circle (instead of a point and an outer 
> circle)? If so, I wonder how to simulate that on other platforms as well...

It does not. IconVG follows SVG here, not cairo / Quartz.

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