[go-nuts] Sharing similar Interfaces across packages

2016-09-24 Thread Tamás Gulácsi
You can embed the interface in two.Item:
type Item interface {
one.Item
Len() int
Swap(item Item)
}

-- 
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] Run a single Golang httptest server for all tests on different packages?

2016-09-24 Thread francescoaferraro
Can anyone explain me why I should attempt to do this?

The below works for a single package only.

func TestMain(m *testing.M) {
setup()
exitVal := m.Run()
teardown()
os.Exit(exitVal)}

func setup() {
flag.StringVar(, "server", "s", "server to set request for")
flag.Parse()
viper.SetDefault("testing", true)
util.BasicStart()
iot.RunDependencies()
cats.SyncS3()
router := cmd.InitRootRouter()
util.SetTestServer(httptest.NewServer(router))}

func teardown() {
log.Println("[TESTS] - Teardown completed")
}


But I was expecting to place to keep the tests inside each package.

src/backend/├── cats│   ├── cat_test.go  // packaget cat_test│   ├── handler.go 
 // package cat│   ├── routes.go│   └── tools.go├── cmd│   ├── populate.go│   
├── root.go│   └── runserver.go├── iot│   └── device│  ├── all.go  // 
packaget device_test
│  ├── all_test.go  // packaget device_test│  ├── router.go│  ├── 
types.go│  └── update.go├── main.go├── main_test.go   //package 
main_test└── root_test.go   //package main


-- 
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] Sharing similar Interfaces across packages

2016-09-24 Thread question . developer

The sort.Interface is designed to operate on an indexed collection. 
Certain data structures may not be indexed (ex. linked list) nor do some 
algorithms need to expose that they are.

Lets say I have one package with the following interface.

package One

type Item interface {
Less(item Item) bool
}

If say *for some reason* it made sense to want to use package One's Item in 
package Two, but package Two already had an Item interface declared. 
I would need to first import package One and explicitly prefix all uses of 
Item to differentiate between the packages.

package Two

import "path/to/package/One" // ignoring the use of '.' notation to import 
package block

// lets say this package has its own Item declared
type Item interface {
Len() int
Less(item Item) bool
Swap(item Item)
}

// lets also assume that Two.Item would not be appropriate for this function
func SomeOperation(a,b One.Item) bool {
...
}

Furthermore the concrete Item will need to cast/assert the type for the 
passed in argument.

package Two

import "path/to/package/One"

type TwoItem int
func (this TwoItem) Less(item One.Item) {
return this < item.(TwoItem)
}


Is there a cleaner more elegant way to setup *this given* relationship? One 
maybe that isn't as verbose (ex. share a single interface) and avoid the 
casting?
I presume, that the proper convention would be to not share the interface 
but I want to get an idea of other patterns that could be applied here.




-- 
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] ws-cli - WebSocket Command Line Client

2016-09-24 Thread mhhcbon
Hi,

nice exercise!

I found out your version was having data races.

try your program like this
go run -race kseo.go -url ws://echo.websocket.org

This program does not need any goroutine, imho,

package main

import (
"flag"
"fmt"
"bufio"
"os"
"net/http"

ws "github.com/gorilla/websocket"
)


func dial(url string, origin string, subprotocol string) (*ws.Conn, error) {
var subprotocols []string
var header http.Header

if subprotocol != "" {
subprotocols = []string{subprotocol}
}
if origin != "" {
header = http.Header{"Origin": {origin}}
}

dialer := ws.Dialer{
Subprotocols:subprotocols,
ReadBufferSize:  1024,
WriteBufferSize: 1024,
}

conn, _, err := dialer.Dial(url, header)
return conn, err
}


func main () {

  var url = flag.String("url", "ws://echo.websocket.org", "url")
var origin = flag.String("origin", "", "optional origin")
var subprotocol = flag.String("subprotocol", "", "optional subprotocol")
flag.Parse()
if *url == "" {
flag.Usage()
return
}

  conn, err := dial(*url, *origin, *subprotocol)
  if err!=nil {
panic(err)
  }

  reader := bufio.NewReader(os.Stdin)
  for {
fmt.Print("> ")
line, err := reader.ReadBytes('\n')
if err !=nil {
  panic(err)
}
line = line[:len(line)-1]
if len(line)==0 {
  fmt.Printf("Type in a message!\n")

} else if string(line)=="quit" {
  fmt.Println("Bye!")
  conn.Close()
  return

} else {
  err := conn.WriteMessage(ws.TextMessage, line)
  if err !=nil {
panic(err)
  }
  _, msg, err := conn.ReadMessage()
  if err != nil {
panic(err)
  }
  fmt.Printf("response: %v\n", string(msg))
}
  }
}


For the fun, i abused of goroutines to read / write ws and read stdin, 
without race conditions.

I d appreciate any comment on this silly attempt

package main

import (
"flag"
"fmt"
"bufio"
"os"
"net/http"

ws "github.com/gorilla/websocket"
)


func dial(url string, origin string, subprotocol string) (*ws.Conn, error) {
var subprotocols []string
var header http.Header

if subprotocol != "" {
subprotocols = []string{subprotocol}
}
if origin != "" {
header = http.Header{"Origin": {origin}}
}

dialer := ws.Dialer{
Subprotocols:subprotocols,
ReadBufferSize:  1024,
WriteBufferSize: 1024,
}

conn, _, err := dialer.Dial(url, header)
return conn, err
}

func writeConn (conn *ws.Conn) (chan<-[]byte, chan bool, chan error) {
  write := make(chan []byte)
  done := make(chan bool)
  errc := make(chan error)
  go func () {
for {
  select {
  case data := <-write:
err := conn.WriteMessage(ws.TextMessage, data)
if err !=nil {
  errc <- err
}
  case <-done:
close(write)
close(done)
close(errc)
return
  }
}
  }()
  return write, done, errc
}

func readLine () (<-chan []byte, chan<-bool, chan bool, chan error) {
  read := make(chan []byte)
  done := make(chan bool)
  errc := make(chan error)
  want := make(chan bool)
  go func () {
reader := bufio.NewReader(os.Stdin)
for {
  select {
  case <-want:
data, err := reader.ReadBytes('\n')
if err != nil {
  errc <- err
}
read<-data
  case <-done:
close(read)
close(done)
close(errc)
return
  }
}
  }()
  return read, want, done, errc
}

func readConn (conn *ws.Conn) (<-chan []byte, chan<-bool, chan bool, chan 
error) {
  read := make(chan []byte)
  done := make(chan bool)
  want := make(chan bool)
  errc := make(chan error)
  go func () {
for {
  select {
  case <-want:
_, data, err := conn.ReadMessage()
if err != nil {
  errc <- err
}
read<-data
  case <-done:
close(read)
close(done)
close(errc)
return
  }
}
  }()
  return read, want, done, errc
}


func main () {

  var url = flag.String("url", "ws://echo.websocket.org", "url")
var origin = flag.String("origin", "", "optional origin")
var subprotocol = flag.String("subprotocol", "", "optional subprotocol")
flag.Parse()
if *url == "" {
flag.Usage()
return
}

  conn, err := dial(*url, *origin, *subprotocol)
  if err!=nil {
panic(err)
  }

  write, writeEnd, writeErr := writeConn(conn)
  read, wantRes, readEnd, readErr := readConn(conn)
  rl, wantRl, rlEnd, rlErr := readLine()

  terminate := func () {
rlEnd<-true
readEnd<-true
writeEnd<-true
conn.Close()
  }

  fmt.Print("> ")
  for {
select {
case wantRl <- true:
case line := <-rl:
  line = line[:len(line)-1]
  if len(line)==0 {
fmt.Printf("Type in a message!\n")
fmt.Print("> ")

  } else if string(line)=="quit" {

RE: [go-nuts] Re: Just because we can add multiple logical processors for the scheduler to use doesn’t mean we should

2016-09-24 Thread John Souvestre
Ø  But A GOMAXPROCS value larger than NumberAvaliableCpuCores will always 
decrease the performance, IMO.



Although unusual, I did have a case where it was handy to use double the value 
of CPUs.  It was a situation where there were a number of low-priority, 
compute-bound processes and a bunch of regular processes.  The regular 
processes saw less latency due to the operating system being able to implement 
its form of fairness when preemptively scheduling the treads/procs.

 

Btw – If you were referring to runtime.NumCPU it’s actually the number of 
logical CPUs, not cores.  Quite often hyperthreading results in more CPUs than 
cores.

 

John

John Souvestre - New Orleans LA

 

From: golang-nuts@googlegroups.com [mailto:golang-nuts@googlegroups.com] On 
Behalf Of T L
Sent: 2016 September 24, Sat 04:22
To: golang-nuts
Subject: [go-nuts] Re: Just because we can add multiple logical processors for 
the scheduler to use doesn’t mean we should

 

Usually, GOMAXPROCS==NumberAvaliableCpuCores (the default value since go1.5) 
will get the best performance. 
For some special cases, a smaller GOMAXPROCS value will perform better.
But A GOMAXPROCS value larger than NumberAvaliableCpuCores will always decrease 
the performance, IMO.

On Friday, September 23, 2016 at 5:56:11 PM UTC+8, WALID BELRHALMIA wrote:

Hello my golang brother,

 

i was reading William kennedy post about Concurency 
https://www.goinggo.net/2014/01/concurrency-goroutines-and-gomaxprocs.html 
and at the end he said "Just because we can add multiple logical processors for 
the scheduler to use doesn’t mean we should"  , because i think that ading the 
max logical CPU to awer program can only add moe performance, can somme one 
provide me with more information.

-- 
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: How to pass arbitrary typed (int, string, etc) slices to a golang function?

2016-09-24 Thread Roberto Zanotto
If you don't care about preserving the order of the elements in the slice, 
you can do something like this:
https://play.golang.org/p/6QWxWH-Oj7

The functions I used are documented here: https://golang.org/pkg/reflect/
You may want to read this blog post about 
reflection: https://blog.golang.org/laws-of-reflection
Reflection is the only way to make the function generic.
If you need performance, you can write specialized functions for int, 
float, string and then use reflect to decide which one to call.

On Saturday, September 24, 2016 at 10:10:07 PM UTC+2, Lax Clarke wrote:
>
>
>
> On Friday, September 23, 2016 at 12:30:36 AM UTC-4, Dave Cheney wrote:
>>
>> There are two ways, one is to use reflection, the other would be to use 
>> unsafe to convert the slice value into another structure then extract the 
>> length field. 
>>
>> Assuming that you could write a Len function as you specified, what would 
>> you do next? What problem are you trying to solve?
>>
>
> Ok, I'm sorry for not stating actual problem.
> I'm trying to remove duplicates from slices (of various types, strings, 
> int, float is enough for now).
> This requires me to create a map from that type to boolean, for example, 
> as part of the algorithm.
>
> I cannot figure out how to make such a function work for all types (note 
> I'm coming from C++ and Java where I knew how to do this). 
>

-- 
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] How to generate a positive int64 from byte slice

2016-09-24 Thread JohnGB
The 32 bytes were just a product of the hash function that we were using, 
but I've simplified it by changing the hash function to one that only 
generates 8 bytes.

My current solution is:

func EmailToID(email, salt string) int64 {

d := sha3.NewShake256()
d.Write([]byte(email))
d.Write([]byte(salt))
h := make([]byte, 8)
d.Read(h)

var n int64
buff := bytes.NewBuffer(h)
binary.Read(buff, binary.LittleEndian, )
if n < 0 {
n *= -1
}
return n
}

So, I'm actually using all 64 bits, but taking the absolute value of the 
resulting int64, which in effect means that I'm only considering 63 bytes.


On Saturday, 24 September 2016 02:32:24 UTC+2, Caleb Spare wrote:
>
> You'll probably want to use encoding/binary. 
>
> But which 8 of the 32 bytes are you going to use? (or really, which 63 
> bits?) 
>
> -Caleb 
>
> On Fri, Sep 23, 2016 at 5:25 PM, JohnGB  
> wrote: 
> > I have a byte slice 32 bytes long, and I would like to use it to 
> generate a 
> > positive int64.  Is there a standard way to do this, or do I need to 
> write 
> > my own function (most likely using bit shifts)? 
> > 
> > The backstory is that I need to generate unique (low collision 
> likelihood) 
> > integer IDs from email addresses.  However it needs to be that every 
> time a 
> > given email is used to generate an int64, that it generates the same 
> int64. 
> > I've settled on using a SHA3 hash with a salt to get a low collision 
> byte 
> > slice, which I then need to generate a positive int64 from. 
> > 
> > -- 
> > 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] Re: How to pass arbitrary typed (int, string, etc) slices to a golang function?

2016-09-24 Thread Roberto Zanotto
https://play.golang.org/p/XjcT8wFXVV

On Friday, September 23, 2016 at 6:13:04 AM UTC+2, Lax Clarke wrote:
>
> How would someone create a function like len ?
>
> func Len(s []interface{})   would not work because compiler complains of 
> type mismatch if you call it with an integer slice (for example)
>
> 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] Re: How to pass arbitrary typed (int, string, etc) slices to a golang function?

2016-09-24 Thread Lax Clarke


On Friday, September 23, 2016 at 12:30:36 AM UTC-4, Dave Cheney wrote:
>
> There are two ways, one is to use reflection, the other would be to use 
> unsafe to convert the slice value into another structure then extract the 
> length field. 
>
> Assuming that you could write a Len function as you specified, what would 
> you do next? What problem are you trying to solve?
>

Ok, I'm sorry for not stating actual problem.
I'm trying to remove duplicates from slices (of various types, strings, 
int, float is enough for now).
This requires me to create a map from that type to boolean, for example, as 
part of the algorithm.

I cannot figure out how to make such a function work for all types (note 
I'm coming from C++ and Java where I knew how to do this). 

-- 
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] ws-cli - WebSocket Command Line Client

2016-09-24 Thread KwangYul Seo
Hello,

I am happy to announce the release of the ws-cli, a simple WebSocket
command line client written in Go.

https://github.com/kseo/ws-cli


# Installation

go get github.com/kseo/ws-cli

# Usage

$ we-cli -url ws://echo.websocket.org
connected (press CTRL+C to quit)
> hi there
< hi there
> are you a happy parrot?
< are you a happy parrot?

Regards,
Kwang Yul Seo

-- 
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] x/tools/cmd/gotype: invalid encoding format in export data: got 'v'; want 'c' or 'd'

2016-09-24 Thread Albert Nigmatzianov
When I use gotype, it says:
version.go:8:2: could not import github.com/bogem/nehm/ui (reading export 
data: /Users/albert/go/pkg/darwin_amd64/github.com/bogem/nehm/ui.a: invalid 
encoding format in export data: got 'v'; want 'c' or 'd')
version.go:9:2: could not import github.com/spf13/cobra (reading export 
data: /Users/albert/go/pkg/darwin_amd64/github.com/spf13/cobra.a: invalid 
encoding format in export data: got 'v'; want 'c' or 'd')
...

And so on
Why does it happen?

-- 
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: Trying to understand GOPATH

2016-09-24 Thread Simon Ritchie
This could be a bit better explained on the golang website.  

First, note that there are potentially three environment variables 
involved: PATH; GOROOT and GOPATH.

The Getting Started guide (https://golang.org/doc/install#install) gives 
quite a lot of help, and you should read that thoroughly.  Firstly it says:

"The Go binary distributions assume they will be installed in /usr/local/go 
(or c:\Go under Windows), but it is possible to install the Go tools to a 
different location. In this case you must set the GOROOT environment 
variable to point to the directory in which it was installed."

So, you either install the tools in the default location or you set GOROOT.

If you have this include:

include ("log")

Then the compiler can find the log package in either the default location 
or the one in GOROOT.  

My Go installation is in the default /usr/local/go, so my log package is in 
/usr/local/go/pkg/linux_amd64/log.a.  The source code is in 
/usr/local/go/src/log.

I set up my .profile to put /usr/local/go/bin into my PATH, so I can run 
the go tools.

Assume that I set the GOPATH variable like so 

export GOPATH="/home/simon/gocode:/home/simon/goprojects/films"

and I run

go get github.com/emicklei/go-restful

This fetches the go-restful package and puts it into THE FIRST directory in 
the GOPATH.  So now I have

/home/simon/gocode/src/github.com/emicklei/go-restful/

containing the source code and

/home/simon/gocode/pkg/linux_amd64/github.com/emicklei/go-restful.a 

containing the compiled object

I can now have this include

include github.com/emicklei/go-restful

My own project lives in the second directory in the GOPATH - 
/home/simon/goprojects/films.  As  Volker explained, this should contain a 
directory src containing the source code.  When I run the compiler, it will 
create directories pkg and bin.

The Getting Started guide goes on to explain how to create source code that 
you can commit to the github.  "Next, make the directories 
src/github.com/user/hello inside your workspace (if you use GitHub, 
substitute your user name for user), and inside the hello directory create 
a file named hello.go"

In fact, if you are going to commit your project to the github, then you 
should create an empty project on github.com first and then clone it on 
your machine.  This creates a directory for you, an empty git repository.  
It contains a "hidden" directory .git containing all the information that 
git needs to work.  When you have everything working, you can commit your 
files and push them to the github.

For example, I have a github account goblimey and I used the github.com 
website to create a project called films.  I then did this on my machine:
  
cd /home/simon
mkdir goprojects
cd goprojects
clone https://github.com/goblimey/films  # creates a directory films

export GOPATH="/home/simon/gocode:/home/simon/goprojects/films"
export 
PATH=$PATH:/home/simon/gocode/bin:/home/simon/goprojects/films/bin

So now I have a github repository in the directory films and the two bin 
directories are in my PATH.  One of the bin directories doesn't exist yet, 
but the first compilation will create it.

In the films directory I create src/github.com/goblimey/films.  My source 
code lives in there.  

So, I end up with 
/home/simon/goprojects/films/src/github.com/goblimey/films containing my 
source code.

To install it, I use this command (which I can run from any directory)

go install github.com/goblimey/films

This looks through the directories in my GOPATH looking for one that 
contains src/github.com/goblimey/films and compiles the contents.

The result goes into /home/simon/goprojects/films/pkg and 
/home/simon/goprojects/films/bin.

Given any include, the compiler will search for it in either the default 
compiler location or GOROOT, plus the directories in GOPATH.  In my case, 
that will be:

/usr/local/go/pkg
/home/simon/gocode/pkg/linux_amd64
/home/simon/goprojects/films/pkg/linux_amd64

Once I have everything working, I commit the result to the github BUT not 
the bin or pkg directories.  Only the src directory.  That gives enough 
information for somebody to clone my project and build it themselves.  
Their bin and pkg directories will be different from mine, so we don't want 
them in the repository.  (In general, if file B is created from file A, put 
A into the repository but not B.)

The scheme I use allows me to have Go projects in different directories.  
That requires a different GOPATH setting for each one, so I create a script 
in each project directory that sets up the GOPATH.

If you want to, you can put just a single directory in your GOPATH.  In 
that case, it will contain everything that you fetch using go get and 
everything that you create yourself.  I prefer to keep things separate.

To sum up, this issue is really quite a complicated.  You need to read the 
documentation carefully, but there are gaps in 

[go-nuts] Re: Just because we can add multiple logical processors for the scheduler to use doesn’t mean we should

2016-09-24 Thread T L
Usually, GOMAXPROCS==NumberAvaliableCpuCores (the default value since 
go1.5) will get the best performance. 
For some special cases, a smaller GOMAXPROCS value will perform better.
But A GOMAXPROCS value larger than NumberAvaliableCpuCores will always 
decrease the performance, IMO.

On Friday, September 23, 2016 at 5:56:11 PM UTC+8, WALID BELRHALMIA wrote:
>
> Hello my golang brother,
>
> i was reading William kennedy post about Concurency 
> https://www.goinggo.net/2014/01/concurrency-goroutines-and-gomaxprocs.html  
>and at the end he said "Just because we can add multiple logical 
> processors for the scheduler to use doesn’t mean we should"  , because i 
> think that ading the max logical CPU to awer program can only add moe 
> performance, can somme one provide me with more information.
>

-- 
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] Refer a different package from the godoc of a package

2016-09-24 Thread Debraj Manna
Can someone let me if it is possible to refer a different package from godoc of
a package? For example let's say I have a package src/logger/. In
src/logger/doc.go I need to refer src/config/. Something like @see in
javadoc.

Is there a recommended way?

I am on Go 1.7.

-- 
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: Adding YAML to the stdlib

2016-09-24 Thread paraiso . marc
Anybody can write a spec and deem it a standard.

YAML is certainly not a common data serialization format. Adding a YAML 
parser is in my opinion the least of of Go's priorities when one can see 
all the packages pilling up @ /x/ namespace that should have been in the 
stdlib already. More tools supporting XML development might actually make 
more sense, like support for SAX,XML schema,SOAP, XSL,XPath and all these 
API a lot of entreprise developers still need to interact with. Because 
frankly working with XML in Go is a pain in the arse.

Le vendredi 23 septembre 2016 22:02:51 UTC+2, Zachary Gershman a écrit :
>
> Gustavo - it is not jus that YAML is well known, it is also widely used 
> (as I even mentioned). It is a *standard *even though some may not want 
> to consider it as such. If I can read xml in the stdlib why not yaml? And 
> it is widely supported now but are you committed to supporting it for as 
> long as golang is around?
>
> On Friday, September 23, 2016 at 11:28:27 AM UTC-7, Gustavo Niemeyer wrote:
>>
>> Hi Zachary,
>>
>> You have already seen the thread, but for the benefit of others, Zach's 
>> email comes from a thread raised and replied to yesterday on Twitter:
>>
>> https://twitter.com/jvehent/status/778687333956587522
>>
>> As I said there, the yaml spec is big, messy, and I wouldn't encourage 
>> having the package in the distribution of Go. Something being well known 
>> and appreciated is not a reason to have it in the standard library.
>>
>> Also, there's nothing unfair about maintaining go-yaml. This was 
>> developed years ago while porting the first projects of Canonical to Go, 
>> and is by now widely used there, and we remain committed to supporting it. 
>> I also receive regular fixes and contributions from the community, and 
>> nobody seems upset to do so.
>>
>> The most recent change was to replace the LGPL license by Apache, which 
>> was well received. I was able to negotiate that based on requested from the 
>> community, and were were able to do so due to the CLA that is requested for 
>> contributions (ironic that most people CLA's as evil, yet it was used to 
>> open permissions further).
>>
>>
>>
>> On Fri, Sep 23, 2016 at 2:53 PM, Zachary Gershman  
>> wrote:
>>
>>> Hey All,
>>>
>>> I wanted to get feedback here first before I move this over to the 
>>> golang-dev mailing list (or maybe we even just start a change-set).  YAML 
>>> as a spec is not the greatest and some would even describe it as "gross" 
>>> but most if not all config files are written in some form of YAML (see 
>>> kubernetes as a prime example).  YAML was not included in the stdlib and 
>>> luckily for all of us the awesome go-yaml 
>>>  emerged as the de facto standard for 
>>> a majority of developers.
>>>
>>> Now, inclusion into the stdlib must pass a high bar 
>>>  and not everything can / should 
>>> be included but I believe that when you have over 1300 packages 
>>>  depending on an outside 
>>> library, you should at least have the discussion openly about whether it 
>>> should be moved into the stdlib.
>>>
>>> Also, it is slightly unfair to have the expectation that the community 
>>> should support a significant format through independent OSS work.
>>>
>>
>>
>>
>> -- 
>>
>> gustavo @ http://niemeyer.net
>>
>

-- 
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] styx - create 9P2000 file servers

2016-09-24 Thread David Arroyo
https://aqwari.net/net/styx

It has taken quite a few more weekends than I expected, but I've
produced the styx package and its subpackages as a way to write 9P file
servers, with https://github.com/droyo/jsonfs serving as a demo. I have
tried to take some inspiration from the standard library's net/http
package, without hiding the statefulness of the 9P2000 protocol. It is
still early days; I am still filling in gaps in the tests and
documentation, but this project has been a lot of fun for me and I
wanted to share. Any feedback is appreciated.

- David

-- 
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] os.Getwd() returns path separated with "\" in windows troubles me

2016-09-24 Thread Ally Dale
I think I know what the mistake is, thanks a lot.

在 2016年9月24日星期六 UTC+8上午1:33:58,Ian Lance Taylor写道:
>
> On Fri, Sep 23, 2016 at 8:54 AM, Ally  Dale  > wrote: 
> > Golang std library such as path.Split() all suppose path is separated 
> with 
> > "/". 
>
> Note that the path package is for slash separated strings, like URLs. 
>
> If you are dealing with files, you should be using the path/filepath 
> package. 
>
> 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.