Skip to content

Instantly share code, notes, and snippets.

@gbitten
gbitten / go2draft-generics-proposal-II.md
Last active March 6, 2019 10:10
go2draft-proposal-II.md

Contracts only for Generic Types

Abstract

This is my second proposal based on Lance Taylor and Robert Griesemer's proposal for Go 2 "generics" (Contracts — Draft Design). Although they are very similar, it is a simplification of the original but keeps its capabilities.

Original proposal

Generic functions

According the Contracts proposal, "generic code is code that is written using types that will be specified later". To achieve that, it defines generic functions using an unspecified type called type parameter. When the code is used, the type parameter is set to a type argument.

@gbitten
gbitten / go2draft-generics-proposal.md
Last active February 28, 2019 15:04
Go 2 Generics - Contract with methods

Contracts with methods

Abstract

This proposal is based on Lance Taylor and Robert Griesemer's proposal for Go 2 "generics" (Contracts — Draft Design). It is identical of the original regarding type parameters, but gives a different solution for contracts.

Generic functions

According the Contracts proposal, "generic code is code that is written using types that will be specified later". To achieve that, it defines generic functions using an unspecified type called type parameter. When the code is used, the type parameter is set to a type argument.

@gbitten
gbitten / golang-tls.md
Created September 10, 2016 13:18 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048
    
# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
openssl ecparam -genkey -name secp384r1 -out server.key
@gbitten
gbitten / tls-client.go
Created September 10, 2016 13:11 — forked from michaljemala/tls-client.go
SSL Client Authentication Golang sample
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io/ioutil"
"log"
"net/http"
)