Hi!
Thanks for your feedback. I think it is not hard to make this program
data-race free if you give up readline library.
The problem lies on the fact that readline's Instance.Readline function is
not go routine friendly. It is a blocking call which won't return until a
line is entered or an inte
Wouldn't then the argument being passed into Less(Item) and Swap(Item) be
for two different interfaces?
One.Item for Less() and Two.Item for Swap().
On Saturday, September 24, 2016 at 10:31:56 PM UTC-7, Tamás Gulácsi wrote:
>
> You can embed the interface in two.Item:
> type Item interface {
>
Wouldn't then the argument being passed into Less(Item) and Swap(Item) be
for two different Items?
One.Item for Less() and Two.Item for Swap().
On Saturday, September 24, 2016 at 10:31:56 PM UTC-7, Tamás Gulácsi wrote:
>
> You can embed the interface in two.Item:
> type Item interface {
>
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 go
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(&util.ServerFlag, "server", "s", "server to set request for")
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)
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/go
Ø 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 o
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/
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(sa
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 examp
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
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
> ar
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 (read
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.
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, Se
The default of using only one thread to run goroutines default changed with Go
1.5 to using all available cores reported by the OS. Tuning GOMAXPROCS has now
less relevance in practice, rendering the article as outdated in that regard.
Just leave the GOMAXPROCS settings alone until a strong use
a) A package doesn't need to be in the stdlib to have more than one
maintainer. If you believe go-yaml needs more maintenance, you can either
ask Gustavo to give more people push-access, or create a better-maintained
fork. There are tons of go projects out there that are well-maintained by a
vibran
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 messa
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 s
20 matches
Mail list logo