[go-nuts] array indexed by derived type?

2018-10-06 Thread Steven Roth
Is there a way to declare an array (or slice) that is indexed by a type
derived from int, rather than indexed by int?  My intent is to have the
compiler complain if I index the array/slice with a generic int rather than
the specific int-derived type I'm supposed to use.  This will help verify
correct usage of the array.  I didn't see any way to do this in the
language spec, but hopefully I just missed it?

Thanks,
Steve

-- 
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] Traverse directory without infinite loops while following symlinks

2018-10-06 Thread rob solomon
I've been trying to do something simple like this, but I'm not 
interested in following symlinks.  Here I just am interested in summing 
all subdirectories from my start directory.  But I'm not geting 
consistent sums, especially if I start from my home directory.


I guess I'm not handling errors, but I don't know how to handle them in 
a way that allows continuing w/ all directories until all 
non-error-producing directories are walked and summed.


I don't want to follow symlinks.

I use this on Ubuntu amd64 16.04, 18.04 and Win10.

Compiled w/ 1.11.1 (and earlier, but that doesn't matter now).

I don't know how to post code without bombing this list.

package main

import (
    "bufio"
    "fmt"
    "os"
    "path/filepath"
    "sort"
    "strconv"
)

const LastAltered = "5 Oct 2018"

type directory struct {
    name string
    subtotal int64
}

type dirslice []directory

func (ds dirslice) Less(i, j int) bool {
    return ds[i].subtotal > ds[j].subtotal // I want a reverse sort, 
largest first

}

func (ds dirslice) Swap(i, j int) {
    ds[i], ds[j] = ds[j], ds[i]
}

func (ds dirslice) Len() int {
    return len(ds)
}

func main() {
    var GrandTotalSize, TotalOfFiles int64
    var startDirectory string
    var dirList dirslice

    fmt.Println()
    fmt.Println(" dirmap sums the directories it walks.  Written in 
Go.  Last altered ", LastAltered)


    if len(os.Args) < 2 {
        startDirectory, _ = os.Getwd()
    } else {
        startDirectory = os.Args[1]
    }
    start, err := os.Stat(startDirectory)
    if err != nil || !start.IsDir() {
        fmt.Println(" usage: diskwalk ")
        os.Exit(1)
    }

    dirList = make(dirslice, 0, 500)
    DirMap := make(map[string]int64, 500)
    DirAlreadyWalked := make(map[string]bool, 500)

    // walkfunc closure
    filepathwalkfunc := func(fpath string, fi os.FileInfo, err error) 
error {

        if err != nil {
            fmt.Printf(" Error from walk.  Grand total size is %d in %d 
number of files, error is %v. \n ", GrandTotalSize, TotalOfFiles, err)

            return filepath.SkipDir
        }

        if !fi.Mode().IsRegular() {
            if fi.IsDir() {
                if DirAlreadyWalked[fi.Name()] {
                    return filepath.SkipDir
                } else {
                    DirAlreadyWalked[fi.Name()] = true
                }
            } else {
                return filepath.SkipDir
            }
        }

        //  Now have a regular file.
        TotalOfFiles++
        GrandTotalSize += fi.Size()
        DirMap[filepath.Dir(fpath)] += fi.Size()

        return nil
    }

    filepath.Walk(startDirectory, filepathwalkfunc)

    // Prepare for output.
    s2 := ""
    var i int64 = GrandTotalSize
    switch {
    case GrandTotalSize > 1e12: // 1 trillion, or TB
        i = GrandTotalSize / 1e12   // I'm forcing an integer division.
        if GrandTotalSize%1e12 > 5e11 { // rounding up
            i++
        }
        s2 = fmt.Sprintf("%d TB", i)
    case GrandTotalSize > 1e9: // 1 billion, or GB
        i = GrandTotalSize / 1e9
        if GrandTotalSize%1e9 > 5e8 { // rounding up
            i++
        }
        s2 = fmt.Sprintf("%d GB", i)
    case GrandTotalSize > 100: // 1 million, or MB
        i = GrandTotalSize / 100
        if GrandTotalSize%100 > 50 {
            i++
        }
        s2 = fmt.Sprintf("%d MB", i)
    case GrandTotalSize > 1000: // KB
        i = GrandTotalSize / 1000
        if GrandTotalSize%1000 > 500 {
            i++
        }
        s2 = fmt.Sprintf("%d KB", i)
    default:
        s2 = fmt.Sprintf("%d", i)
    }

    GrandTotalString := strconv.FormatInt(GrandTotalSize, 10)
    GrandTotalString = AddCommas(GrandTotalString)
    fmt.Print(" start dir is ", startDirectory, "; found ", 
TotalOfFiles, " files in this tree. ")
    fmt.Println(" Total Size of walked tree is", GrandTotalString, 
"or", s2, ", and len of DirMap is", len(DirMap))


    // Output map
    for n, m := range DirMap { // n is name as a string, m is map as a 
directory subtotal

        d := directory{} // this is a structured constant
        d.name = n
        d.subtotal = m
        dirList = append(dirList, d)
    }
    fmt.Println(" Length of sorted dirList is", len(dirList), ", length 
of DirAlreadyWalked is", len(DirAlreadyWalked))

    sort.Sort(dirList)

    datestr := MakeDateStr()
    outfilename := filepath.Base(startDirectory) + datestr + ".txt"
    outfile, err := os.Create(outfilename)
    defer outfile.Close()
    outputfile := bufio.NewWriter(outfile)
    defer outputfile.Flush()

    if err != nil {
        fmt.Println(" Cannot open outputfile ", outfilename, " with 
error ", err)
        // I'm going to assume this branch does not occur in the code 
below.  Else I would need a

        // stop flag of some kind to write to screen.
    }

    if len(dirList) < 30 {
        for _, d := range dirList {
            str := strconv.FormatInt(d.subtotal, 10)
            str = AddC

Re: [go-nuts] `go mod download -json` does not product valid json?

2018-10-06 Thread thepudds1460
Hi kalekold,

It looks like it is a stream of JSON objects? 

If so, I suspect this is expected?

See related discussion here (for 'go list -m -u -json' in this case), along 
with sample code for parsing:

  https://github.com/golang/go/issues/27655

--thepudds


On Saturday, October 6, 2018 at 12:26:32 PM UTC-4, kalekold wrote:
>
> It should be:
>
> [{
>   "Path": "github.com/fatih/color", "Version": "v1.7.0",
>  "Info": "/media/Data/Projects/Go/pkg/mod/cache/download/
> github.com/fatih/color/@v/v1.7.0.info",
>  "GoMod": "/media/Data/Projects/Go/pkg/mod/cache/download/
> github.com/fatih/color/@v/v1.7.0.mod",
>  "Zip": "/media/Data/Projects/Go/pkg/mod/cache/download/
> github.com/fatih/color/@v/v1.7.0.zip",
>  "Dir": "/media/Data/Projects/Go/pkg/mod/github.com/fatih/color@v1.7.0",
>  "Sum": "h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=",
>  "GoModSum": "h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4="
> },{
> ...
> }]
>
> Notice the array, it's missing in the example above. This means this 
> output can not be parsed.
>
> On Saturday, 6 October 2018 17:24:35 UTC+1, kalekold wrote:
>>
>> I simply run `go mod download -json` and it outputs this (which isn't 
>> valid.)
>>
>> {
>>  "Path": "github.com/fatih/color",
>>  "Version": "v1.7.0",
>>  "Info": "/media/Data/Projects/Go/pkg/mod/cache/download/
>> github.com/fatih/color/@v/v1.7.0.info",
>>  "GoMod": "/media/Data/Projects/Go/pkg/mod/cache/download/
>> github.com/fatih/color/@v/v1.7.0.mod",
>>  "Zip": "/media/Data/Projects/Go/pkg/mod/cache/download/
>> github.com/fatih/color/@v/v1.7.0.zip",
>>  "Dir": "/media/Data/Projects/Go/pkg/mod/github.com/fatih/color@v1.7.0",
>>  "Sum": "h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=",
>>  "GoModSum": "h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4="
>> }
>> {
>>  "Path": "github.com/mattn/go-colorable",
>>  "Version": "v0.0.9",
>>  "Info": "/media/Data/Projects/Go/pkg/mod/cache/download/
>> github.com/mattn/go-colorable/@v/v0.0.9.info",
>>  "GoMod": "/media/Data/Projects/Go/pkg/mod/cache/download/
>> github.com/mattn/go-colorable/@v/v0.0.9.mod",
>>  "Zip": "/media/Data/Projects/Go/pkg/mod/cache/download/
>> github.com/mattn/go-colorable/@v/v0.0.9.zip",
>>  "Dir": "/media/Data/Projects/Go/pkg/mod/
>> github.com/mattn/go-colorable@v0.0.9",
>>  "Sum": "h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=",
>>  "GoModSum": "h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU="
>> }
>> {
>>  "Path": "github.com/mattn/go-isatty",
>>  "Version": "v0.0.4",
>>  "Info": "/media/Data/Projects/Go/pkg/mod/cache/download/
>> github.com/mattn/go-isatty/@v/v0.0.4.info",
>>  "GoMod": "/media/Data/Projects/Go/pkg/mod/cache/download/
>> github.com/mattn/go-isatty/@v/v0.0.4.mod",
>>  "Zip": "/media/Data/Projects/Go/pkg/mod/cache/download/
>> github.com/mattn/go-isatty/@v/v0.0.4.zip",
>>  "Dir": "/media/Data/Projects/Go/pkg/mod/
>> github.com/mattn/go-isatty@v0.0.4",
>>  "Sum": "h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=",
>>  "GoModSum": "h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4="
>> }
>> {
>>  "Path": "golang.org/x/sys",
>>  "Version": "v0.0.0-20181005133103-4497e2df6f9e",
>>  "Info": "/media/Data/Projects/Go/pkg/mod/cache/download/
>> golang.org/x/sys/@v/v0.0.0-20181005133103-4497e2df6f9e.info",
>>  "GoMod": "/media/Data/Projects/Go/pkg/mod/cache/download/
>> golang.org/x/sys/@v/v0.0.0-20181005133103-4497e2df6f9e.mod",
>>  "Zip": "/media/Data/Projects/Go/pkg/mod/cache/download/
>> golang.org/x/sys/@v/v0.0.0-20181005133103-4497e2df6f9e.zip",
>>  "Dir": "/media/Data/Projects/Go/pkg/mod/
>> golang.org/x/sys@v0.0.0-20181005133103-4497e2df6f9e",
>>  "Sum": "h1:EfdBzeKbFSvOjoIqSZcfS8wp0FBLokGBEs9lz1OtSg0=",
>>  "GoModSum": "h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY="
>> }
>>
>>
>> On Saturday, 6 October 2018 16:24:42 UTC+1, Ian Davis wrote:
>>>
>>> On Sat, 6 Oct 2018, at 3:07 PM, 'kalekold' via golang-nuts wrote:
>>>
>>> `go mod download -json` does not product valid json? Is this a known 
>>> issue or am I missing something?
>>>
>>>
>>> Do you have an example that shows the invalid json?
>>>
>>>

-- 
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: splitting package question

2018-10-06 Thread T L
You can make some tests to check the final binary sizes, which will not 
spend you much time. :)

The official linker does try to remove many unused functions.
Unused functions really need more time to compile.

On Saturday, October 6, 2018 at 10:08:43 AM UTC-4, Vasiliy Tolstov wrote:
>
> Hi! 
> I have some data that can be formatted with json, text and binary form. 
> Does i need to split this on three parts (json, text, binary) to avoid 
> compile time and run time overhead (and disk size of resulted binary) 
> if user want to use only one format (for example binary). Or go 
> compiler remove unused functions and not include them in resulted 
> binary? (if i don't use json Marshal/Unmarshal full json package not 
> included in my binary) 
> Thanks! 
>
> -- 
> Vasiliy Tolstov, 
> e-mail: v.to...@selfip.ru  
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] `go mod download -json` does not product valid json?

2018-10-06 Thread 'kalekold' via golang-nuts
It should be:

[{
  "Path": "github.com/fatih/color", "Version": "v1.7.0",
 "Info": "/media/Data/Projects/Go/pkg/mod/cache/download/
github.com/fatih/color/@v/v1.7.0.info",
 "GoMod": "/media/Data/Projects/Go/pkg/mod/cache/download/
github.com/fatih/color/@v/v1.7.0.mod",
 "Zip": "/media/Data/Projects/Go/pkg/mod/cache/download/
github.com/fatih/color/@v/v1.7.0.zip",
 "Dir": "/media/Data/Projects/Go/pkg/mod/github.com/fatih/color@v1.7.0",
 "Sum": "h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=",
 "GoModSum": "h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4="
},{
...
}]

Notice the array, it's missing in the example above. This means this output 
can not be parsed.

On Saturday, 6 October 2018 17:24:35 UTC+1, kalekold wrote:
>
> I simply run `go mod download -json` and it outputs this (which isn't 
> valid.)
>
> {
>  "Path": "github.com/fatih/color",
>  "Version": "v1.7.0",
>  "Info": "/media/Data/Projects/Go/pkg/mod/cache/download/
> github.com/fatih/color/@v/v1.7.0.info",
>  "GoMod": "/media/Data/Projects/Go/pkg/mod/cache/download/
> github.com/fatih/color/@v/v1.7.0.mod",
>  "Zip": "/media/Data/Projects/Go/pkg/mod/cache/download/
> github.com/fatih/color/@v/v1.7.0.zip",
>  "Dir": "/media/Data/Projects/Go/pkg/mod/github.com/fatih/color@v1.7.0",
>  "Sum": "h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=",
>  "GoModSum": "h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4="
> }
> {
>  "Path": "github.com/mattn/go-colorable",
>  "Version": "v0.0.9",
>  "Info": "/media/Data/Projects/Go/pkg/mod/cache/download/
> github.com/mattn/go-colorable/@v/v0.0.9.info",
>  "GoMod": "/media/Data/Projects/Go/pkg/mod/cache/download/
> github.com/mattn/go-colorable/@v/v0.0.9.mod",
>  "Zip": "/media/Data/Projects/Go/pkg/mod/cache/download/
> github.com/mattn/go-colorable/@v/v0.0.9.zip",
>  "Dir": "/media/Data/Projects/Go/pkg/mod/
> github.com/mattn/go-colorable@v0.0.9",
>  "Sum": "h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=",
>  "GoModSum": "h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU="
> }
> {
>  "Path": "github.com/mattn/go-isatty",
>  "Version": "v0.0.4",
>  "Info": "/media/Data/Projects/Go/pkg/mod/cache/download/
> github.com/mattn/go-isatty/@v/v0.0.4.info",
>  "GoMod": "/media/Data/Projects/Go/pkg/mod/cache/download/
> github.com/mattn/go-isatty/@v/v0.0.4.mod",
>  "Zip": "/media/Data/Projects/Go/pkg/mod/cache/download/
> github.com/mattn/go-isatty/@v/v0.0.4.zip",
>  "Dir": "/media/Data/Projects/Go/pkg/mod/github.com/mattn/go-isatty@v0.0.4
> ",
>  "Sum": "h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=",
>  "GoModSum": "h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4="
> }
> {
>  "Path": "golang.org/x/sys",
>  "Version": "v0.0.0-20181005133103-4497e2df6f9e",
>  "Info": "/media/Data/Projects/Go/pkg/mod/cache/download/
> golang.org/x/sys/@v/v0.0.0-20181005133103-4497e2df6f9e.info",
>  "GoMod": "/media/Data/Projects/Go/pkg/mod/cache/download/
> golang.org/x/sys/@v/v0.0.0-20181005133103-4497e2df6f9e.mod",
>  "Zip": "/media/Data/Projects/Go/pkg/mod/cache/download/
> golang.org/x/sys/@v/v0.0.0-20181005133103-4497e2df6f9e.zip",
>  "Dir": "/media/Data/Projects/Go/pkg/mod/
> golang.org/x/sys@v0.0.0-20181005133103-4497e2df6f9e",
>  "Sum": "h1:EfdBzeKbFSvOjoIqSZcfS8wp0FBLokGBEs9lz1OtSg0=",
>  "GoModSum": "h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY="
> }
>
>
> On Saturday, 6 October 2018 16:24:42 UTC+1, Ian Davis wrote:
>>
>> On Sat, 6 Oct 2018, at 3:07 PM, 'kalekold' via golang-nuts wrote:
>>
>> `go mod download -json` does not product valid json? Is this a known 
>> issue or am I missing something?
>>
>>
>> Do you have an example that shows the invalid json?
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] `go mod download -json` does not product valid json?

2018-10-06 Thread 'kalekold' via golang-nuts
I simply run `go mod download -json` and it outputs this (which isn't 
valid.)

{
 "Path": "github.com/fatih/color",
 "Version": "v1.7.0",
 "Info": 
"/media/Data/Projects/Go/pkg/mod/cache/download/github.com/fatih/color/@v/v1.7.0.info"
,
 "GoMod": 
"/media/Data/Projects/Go/pkg/mod/cache/download/github.com/fatih/color/@v/v1.7.0.mod"
,
 "Zip": 
"/media/Data/Projects/Go/pkg/mod/cache/download/github.com/fatih/color/@v/v1.7.0.zip"
,
 "Dir": "/media/Data/Projects/Go/pkg/mod/github.com/fatih/color@v1.7.0",
 "Sum": "h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=",
 "GoModSum": "h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4="
}
{
 "Path": "github.com/mattn/go-colorable",
 "Version": "v0.0.9",
 "Info": 
"/media/Data/Projects/Go/pkg/mod/cache/download/github.com/mattn/go-colorable/@v/v0.0.9.info"
,
 "GoMod": 
"/media/Data/Projects/Go/pkg/mod/cache/download/github.com/mattn/go-colorable/@v/v0.0.9.mod"
,
 "Zip": 
"/media/Data/Projects/Go/pkg/mod/cache/download/github.com/mattn/go-colorable/@v/v0.0.9.zip"
,
 "Dir": 
"/media/Data/Projects/Go/pkg/mod/github.com/mattn/go-colorable@v0.0.9",
 "Sum": "h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=",
 "GoModSum": "h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU="
}
{
 "Path": "github.com/mattn/go-isatty",
 "Version": "v0.0.4",
 "Info": 
"/media/Data/Projects/Go/pkg/mod/cache/download/github.com/mattn/go-isatty/@v/v0.0.4.info"
,
 "GoMod": 
"/media/Data/Projects/Go/pkg/mod/cache/download/github.com/mattn/go-isatty/@v/v0.0.4.mod"
,
 "Zip": 
"/media/Data/Projects/Go/pkg/mod/cache/download/github.com/mattn/go-isatty/@v/v0.0.4.zip"
,
 "Dir": "/media/Data/Projects/Go/pkg/mod/github.com/mattn/go-isatty@v0.0.4",
 "Sum": "h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=",
 "GoModSum": "h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4="
}
{
 "Path": "golang.org/x/sys",
 "Version": "v0.0.0-20181005133103-4497e2df6f9e",
 "Info": 
"/media/Data/Projects/Go/pkg/mod/cache/download/golang.org/x/sys/@v/v0.0.0-20181005133103-4497e2df6f9e.info"
,
 "GoMod": 
"/media/Data/Projects/Go/pkg/mod/cache/download/golang.org/x/sys/@v/v0.0.0-20181005133103-4497e2df6f9e.mod"
,
 "Zip": 
"/media/Data/Projects/Go/pkg/mod/cache/download/golang.org/x/sys/@v/v0.0.0-20181005133103-4497e2df6f9e.zip"
,
 "Dir": 
"/media/Data/Projects/Go/pkg/mod/golang.org/x/sys@v0.0.0-20181005133103-4497e2df6f9e"
,
 "Sum": "h1:EfdBzeKbFSvOjoIqSZcfS8wp0FBLokGBEs9lz1OtSg0=",
 "GoModSum": "h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY="
}


On Saturday, 6 October 2018 16:24:42 UTC+1, Ian Davis wrote:
>
> On Sat, 6 Oct 2018, at 3:07 PM, 'kalekold' via golang-nuts wrote:
>
> `go mod download -json` does not product valid json? Is this a known issue 
> or am I missing something?
>
>
> Do you have an example that shows the invalid json?
>
>

-- 
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] Why is the method net.PacketConn.ReadFrom named as that? Isn't ReadInto more natural?

2018-10-06 Thread T L
.

-- 
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 monitor "Out of memory" crash

2018-10-06 Thread T L
"out of memory" in Go is not a real (or general) panic
It is a fatal error and will crash your program without a saving mechanism.
https://groups.google.com/forum/#!topic/golang-dev/wUEWhk2jtHM
https://github.com/golang/go/issues/16843
https://stackoverflow.com/questions/30577308/golang-cannot-recover-from-out-of-memory-crash


On Friday, October 5, 2018 at 6:56:50 AM UTC-4, Thomas S wrote:
>
> Hello,
>
> My service crash because "panic - out of memory", and I'm not sure how to 
> monitore it.
> I just want to know, when it crashes, where are the main memory 
> allocations, to understand the problem.
>
> It is pretty sudden, I can hardly use pprof in real time. And has it 
> crashed, pprof can't produce the final file for after-run analysis.
>
> Thank you for your help.
>
> Thomas
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] `go mod download -json` does not product valid json?

2018-10-06 Thread Ian Davis
On Sat, 6 Oct 2018, at 3:07 PM, 'kalekold' via golang-nuts wrote:
> `go mod download -json` does not product valid json? Is this a known
> issue or am I missing something?
Do you have an example that shows the invalid json?

-- 
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] splitting package question

2018-10-06 Thread Vasiliy Tolstov
Hi!
I have some data that can be formatted with json, text and binary form.
Does i need to split this on three parts (json, text, binary) to avoid
compile time and run time overhead (and disk size of resulted binary)
if user want to use only one format (for example binary). Or go
compiler remove unused functions and not include them in resulted
binary? (if i don't use json Marshal/Unmarshal full json package not
included in my binary)
Thanks!

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

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] `go mod download -json` does not product valid json?

2018-10-06 Thread 'kalekold' via golang-nuts
`go mod download -json` does not product valid json? Is this a known issue 
or am I missing something?

-- 
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: Announcing a Fyne GUI toolkit

2018-10-06 Thread R Srinivasan
1. What are the "distribution" considerations?

Considering Windows targets - can we have all the required libraries 
bundled in the final executable? 

2. Can the apps be cross built? i.e. Built on Linux for macOS and 
windows`targets?

thanks for pointers, srini

On Friday, September 14, 2018 at 1:17:00 PM UTC-4, Andrew Williams wrote:
>
> Hi,
>
> Some time ago I realised that Go was a great language for building new 
> applications, as I wanted to use something powerful but fast to learn. I 
> also wanted a really simple to use GUI toolkit that worked cross platform - 
> this was a little more difficult to satisfy!
>
> The aim was to create an API that was:
>
>- Simple to learn
>- Great looking with theme options
>- Truly cross platform with identical look across platforms
>- Solved all of the complicated GUI challenges (threading, scaling etc)
>
> And so the Fyne project was created https://github.com/fyne-io/fyne !
> The design language is basically material design and the rendering is 
> currently EFL with support for Windows, macOS and Linux.
> It's entirely vector based (though you can draw a Raster space if you 
> need) and scales beautifully.
>
> For a taste of what that looks like here you go :)
>
> [image: widgets-dark.png]
>
> It's now well into development and ready for people to get involved. There 
> is a long way to go but it feels like a solid base.
> Instructions for getting started, if you need them, are at 
> https://github.com/fyne-io/bootstrap/blob/master/README.md .
> If you want to know more we're also in the #fyne channel on the gopher 
> Slack server.
>
> Thanks in advance for your thoughts :)
> Andrew
>

-- 
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] ACCU 2019 conference and pre-conference workshops

2018-10-06 Thread Russel Winder
In case you missed it, the ACCU 2019 call for proposals is now open. 
https://cfp.conference.accu.org 

Whilst there is lots of C and C++ content, there is also Java, Kotlin, Python,
Ruby, D, etc. Meson, CMake, Git, Mercurial, Breezy, TDD, BDD, etc. It's a
conference about programming, programming languages, tools and techniques, and
processes. There hasn't been so much Go content recently, though the Rust folk
came along in good numbers last year.

If someone with training experience happened to submit a full day pre-
conference workshop on "Go programming for C and C++ programmers" or some
such, that would be really very good.

Pre-conference workshops Tuesday 2019-04-09
Conference Wednesday 2019-04-10 to Saturday 2019-04-13

Website at https://conference.accu.org 

-- 
Russel.
===
Dr Russel Winder  t: +44 20 7585 2200
41 Buckmaster Roadm: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk

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


signature.asc
Description: This is a digitally signed message part


Re: [go-nuts] go:nosplit

2018-10-06 Thread Scott Cotton
On Sat, 6 Oct 2018 at 08:57, Scott Cotton  wrote:

>
>
> On Fri, 5 Oct 2018 at 23:26, Ian Lance Taylor  wrote:
>
>> On Fri, Oct 5, 2018 at 2:10 PM, Scott Cotton  wrote:
>>
>
>
>> In fact
>> we definitely do want to add other preemption checks that occur at
>> points other than function entry (issues #10958, #24543).  And if
>> there is another preemption check, there are no promises that
>> go:nosplit will disable that check.
>>
>
> From what I understand,  this would
> 1. enable more faire/balanced scheduling
> 2. reduce worst case gc latency
> 3. eliminate problems when programmers unintentionally spin with
> cooperative/stack based
> pre-emption.
> 4. slow things down a bit when fair/balanced scheduling and gc latency and
> 3) are not an issue
> 5. make it impossible to prevent pre-emption in cases that need it or rely
> on cooperative/stack based pre-emption
>

or go:nosplit


> 6. potentially re-order some sequences of system calls,   so that Go
> programmer sequences of system calls G1, G2, ...
> may have Go runtime system calls inserted in between where they weren't
> previously.
>
> I don't think anyone wants 4,5 and 6 is frightening.
>
> Maybe I don't know what I'm doing, so perhaps others can give opinions?
>
> Or should this discussion be on the issue tracker or golang-dev?
>
> Scott
>
>
>
>
>

-- 
Scott Cotton
http://www.iri-labs.com

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