Brendan Tracey | 27 May 17:05 2015
Picon

Write barriers in GC

In the garbage collector coming up for 1.5, pointer writes are memory writes when the GC is off, but they are blocked by a write barrier when GC is on (see for example http://talks.golang.org/2015/state-of-go-may.slide#6). Could someone explain briefly how this is possible? The mutator code does not know when GC will start or end. I would have imagined that the compiled code would either need to have a memory write or need to go through a write barrier, but evidently it can switch somehow. I see how it's possible if there are two versions of everything (with and without write barriers), but I doubt this is the actual approach. I'm missing the mental model for how this can work.

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
EduRam | 27 May 10:00 2015
Picon

Can go std lib support .ini files ?

Hi!

We are starting to evaluate Go lang, by porting some small +20yr old windows C programs.
The 1st task was "let's start to read .ini configuration files".
We were expecting on Windows to do that, but we could not found it on std lib.
That "raise a few eyebrows"! 
But we continue by using one random lib from github.

Even so, is it possible Go Standard Library, to support reading ".ini" files ?

Thanks,

Eduardo

PS: Sorry if this issue was already bring up on discussions.
I did not found it!

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Uriel Fanelli | 27 May 08:13 2015
Picon

Re: Re: Golang for Mission Critical Projects


>
> Nevertheless, I am reminded of Donald Knuth's famous words, "Beware of 
> bugs in the above code; I have only proved it correct, not tried it". 
> Indeed, a formal specification may not actually capture every 
> requirement, due to oversight or lack of formal clarity such as "not 
> able to start fires, flooding or damage third parties".

Maybe, but I was not talking of rewriting every line of code in lambda 
notation and use Hoare logics .
Still, if you want to do it, there are many automatic proof assistant 
now, which can speed the job.

In any case, after a semiformal verification, the quality of software is 
much, much, much higher.

And yes, undert the point of view of insurances, this matters.

But, again, at the end, living means to face reality, so let's see what 
will 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+unsubscribe@...
For more options, visit https://groups.google.com/d/optout.

Uriel Fanelli | 27 May 08:07 2015
Picon

Re: Re: Golang for Mission Critical Projects



On 05/27/2015 04:41 AM, Benjamin Measures wrote:
On Tuesday, 26 May 2015 15:13:03 UTC+1, Uriel Fanelli wrote:
If you think how you do formal verifications  , you are going to do something like that:

You keep using that term- I do not think it means what you think it means.


Indeed, I should have used "semiformal".

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.

webuser1200 | 27 May 02:23 2015
Picon

PostForm and []byte

I'm looking at the following two examples from the docs:

resp, err := http.Post("http://example.com/upload", "image/jpeg", &buf)
...
resp, err := http.PostForm("http://example.com/form",
url.Values{"key": {"Value"}, "id": {"123"}})

Is there any way to pass a []byte data instead of string in url.Values in the PostForm example above. Or I have to do something along the lines in :

http://stackoverflow.com/questions/20205796/golang-post-data-using-the-content-type-multipart-form-data

If it is the latter (using a multi part form), is there an easier way to add form parameters instead of having to do the following for each form field:

    // Add the other fields
    if fw, err = w.CreateFormField("key"); err != nil {
        return
    }
    if _, err = fw.Write([]byte("KEY")); err != nil {
        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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
rojer9 | 27 May 02:03 2015
Picon

controlling buffering of glog

glog's flush interval is currently fixed at 30 seconds which makes tailing them less useful by introducing a delay.
would be nice to have (an equivalent of) glog-cpp's --logbufsecs flag
alternatively, logbuflevel would be sufficient for the simplest case of turning buffering off completely.

P.S.: unaware of the export-only status of the github repository, i created a PR that implements --logbufsecs - https://github.com/golang/glog/pull/12

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
mdlayher | 27 May 00:27 2015
Picon

Adding an IANA-assigned hardware type field to net.Interface

Hello all,

I've been working on a project recently where I require the IANA-assigned hardware type of an interface to generate a unique identifier.  Unfortunately, this functionality does not appear to be available in the Go standard library.  It appears that many of the underlying structures in net/interface_*.go do have the hardware type available, but it is not exposed via any exported types.

I have a very basic patch which seems to work on Linux, FreeBSD, Windows, and OSX, but I wanted to check in and make sure a patch for this functionality would be considered before sending a changelist, as requested in the Contribution Guidelines.

Here's how the net.Interface type might look with this field added:

// Interface represents a mapping between network interface name
// and index.  It also represents network interface facility
// information.
type Interface struct {
        Index        int          // positive integer that starts at one, zero is never used
        MTU          int          // maximum transmission unit
        Name         string       // e.g., "en0", "lo0", "eth0.100"
        HardwareAddr HardwareAddr // IEEE MAC-48, EUI-48 and EUI-64 form
        Flags        Flags        // e.g., FlagUp, FlagLoopback, FlagMulticast
        Type         int          // IANA-assigned hardware type
}

Thank you all for your time.
- Matt Layher

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
acmopar53 | 26 May 20:10 2015
Picon

Open Source Networking Stack

Hey All,

I am a Network Engineer, have been for many years, and I have a problem I am trying to solve, that I think you guys will be able to assist me with.  Everyday I am becoming more and more frustrated with the closed network protocol stacks that are offered by Cisco/Juniper/Arista/etc.  I am tired of being spoon fed the vision from other people for what and how I need to run my network. It is coming to the point where I feel we need to split from these offerings and leverage the open source community to help fix this issue. 

Here is what I am thinking...I want to develop an open source layer 2/3 networking stack that also programs merchant silicon, think Broadcom ASIC's (Trident, Tomahawk, etc). So basically an open network stack from protocol to hardware. I imagine a time when anyone with a whitebox switch can download this software and forward traffic, the same as anyone can download Linux today on to any PC. There is some difficulty with this as we can't expose the IP from the merchant silicon creators.  However, based on recent releases of HAL-like constructs, such as SAI or OpenNSL, I believe this has never been easier. I also want to write the protocol stack in golang as I believe this is the future and will allow easy extensibility overtime.

The major roadblock I am facing is I am not sure how to build a community around such a project. Can you guys offer any suggestions on how I can tackle this project?  I believe the market is screaming for this type of solution and I have already secured funding to help accomplish this task, but I am unsure of the best approach to build a vibrant community. Should I be offering bounties for code? Hire folks from this forum? Something else? How can I jumpstart breathing life into building an open source project such as this?

Just a crazy engineer with a crazy idea looking to change the networking world....

acmopar53

 

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
oleg.lodygensky | 26 May 17:24 2015
Picon

https client authentication using X509

dear all,
I'm new with Go.

I would like to implement an HTTPS authentication mechanism using either X509 certifcate, OAuth...

I have written an HTTPS server just as at the end of this message.

First, to see if this program can validate an user certificate, we can run:
(where /etc/certs/ca contains all known CA certificates)

$>  ./bin/main /etc/certs/ca/ mycert.pem mykey.pem
...
INFO : shains = [[0xc208306d80 0xc208189200]]
...

The ouput shows the user certificate is correctly validated


If I remove the CA validating my certificate from /etc/certs/ca, running the program displays a warning

WARN : failed to parse certificate: x509: certificate signed by unknown authority


So, I guess user certificate validation works well.


Now, I want my HTTPS server to be able to validate user certificate, but when I connect (using firefox) I have the following error

2015/05/26 17:23:12 http: TLS handshake error from [::1]:51227: tls: failed to verify client's certificate: x509: certificate signed by unknown authority


Any clue?

Thanks,
Oleg Lodygenky





HTTPS server code :

func main() {

        var logger = NewPrefixed("main#main")

        if len(os.Args) < 4 {
                logger.Fatal("Usage: %v caCertPath certPath keyPath", os.Args[0])
        }

        //
        // Retrieve CA certificates
        //
        var caRootPool, err = PopulateCertPool(os.Args[1])    // this is x509.NewCertPool.AppendCertsFromPEM() for all found files
        if err != nil {
                logger.Fatal(err.Error())
        }

        //
        // Retrieve  certificate
        //
        theCert, err := CerficateFromPEMs(os.Args[2], os.Args[3])   // this is tls.LoadX509KeyPair() and x509.ParseCertificate()
        if err != nil {
                logger.Fatal(err.Error())
        }

        //
        // Verify cert against known CA
        //
        vOpts := x509.VerifyOptions{Roots: caRootPool}
        chains, err := theCert.Verify(vOpts)
        if err != nil {
                logger.Warn("failed to parse certificate: " + err.Error())
        }
        logger.Info("shains = %v\n", chains)

        ca_b, _ := ioutil.ReadFile(os.Args[2])
        priv_b, _ := ioutil.ReadFile(os.Args[3])
        priv, _ := x509.ParsePKCS1PrivateKey(priv_b)

        cert := tls.Certificate{
                Certificate: [][]byte{ca_b},
                PrivateKey:  priv,
        }

        config := tls.Config{
                RootCAs:      caRootPool,
                Certificates: []tls.Certificate{cert},
                MinVersion: tls.VersionTLS10,
                ClientAuth: tls.VerifyClientCertIfGiven,
        }
        config.Rand = rand.Reader
        var a Authenticator

        http.Handle("/", a)
        server := http.Server{Addr: ":4040", TLSConfig: &config}

        // start https
    logger.Info("Listening HTTPS : 4040")

        server.ListenAndServeTLS(os.Args[2], os.Args[3])
}



--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Fatih Arslan | 26 May 16:18 2015

vim-go v1.0.5 release

Hi,

I've just released vim-go v1.0.5:
https://github.com/fatih/vim-go/releases/tag/v1.0.5

This has a lot of improvements. Especially the gofmt/goimport speedup
(x2), automatic GOPATH detection based on the directory (such as godep
or /src folders) and easy handling of oracle scope are worth to look
at.

Regards

--

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

Василий Кухар | 26 May 10:34 2015
Picon

spec: Support multiple return from map lookup

Hello. I am new to golang, but there is a small proposal.
I don`t know how this affects other parts, may be you will help understand them.
Look at this sample of code: http://play.golang.org/p/ik8RK3p5i7

Seems like compiler doesn`t understand that should return two arguments instead of
s := m["A"] syntax.

Commented code works fine, but is a bit ugly.
Looks like backward-compatible change for me.

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Gmane