From 0eb1c89204c36a49125eccaf450514bf7d5c60ce Mon Sep 17 00:00:00 2001 From: aerth Date: Mon, 8 Oct 2018 00:21:25 -0700 Subject: [PATCH] x509: update generator --- x509/install.sh | 26 +++++++++----------------- x509/x509_splice.go | 21 +-------------------- 2 files changed, 10 insertions(+), 37 deletions(-) mode change 100755 => 100644 x509/install.sh diff --git a/x509/install.sh b/x509/install.sh old mode 100755 new mode 100644 index 5834df7..3cab376 --- a/x509/install.sh +++ b/x509/install.sh @@ -1,17 +1,9 @@ -#!/bin/bash - -set -eu -o pipefail -shopt -s failglob - -cp -a $(go env GOROOT)/src/crypto/x509/* ./ -rm ./x509_test.go - -# The following code is utterly horrifying. I can't find a better way to do it. :( -mkdir -p ${GOPATH}/src/vendor/golang.org/ -cp -R $(go env GOROOT)/src/vendor/golang_org/* ${GOPATH}/src/vendor/golang.org/ -# h/t to https://www.cyberciti.biz/faq/unix-linux-replace-string-words-in-many-files/ -OLD_PACKAGE='"golang_org/x/crypto/cryptobyte' -OLD_PACKAGE="${OLD_PACKAGE//\//\\/}" -NEW_PACKAGE='"golang.org/x/crypto/cryptobyte' -NEW_PACKAGE="${NEW_PACKAGE//\//\\/}" -sed -i "s/${OLD_PACKAGE}/${NEW_PACKAGE}/g" ./*.go ${GOPATH}/src/vendor/golang.org/x/crypto/cryptobyte/*.go +#!/bin/sh +set -e +goroot="$(go env GOROOT)" +x509path=$goroot/src/crypto/x509 +test -d $goroot +test -d $x509path +cp -av $x509path/* . +rm x509_test.go +sed -i.bak 's/golang_org/golang.org/g' x509.go diff --git a/x509/x509_splice.go b/x509/x509_splice.go index 6825f6b..7c1043a 100644 --- a/x509/x509_splice.go +++ b/x509/x509_splice.go @@ -9,7 +9,7 @@ // Last rebased on Go 1.10 // Remove all content between "import" and "CreateCertificate" in original. // Remove all content after "CreateCertificate" in original. -//go:generate bash install.sh +//go:generate sh install.sh // Package x509 parses X.509-encoded keys and certificates. // @@ -20,30 +20,11 @@ package x509 import ( "bytes" - //"crypto" - //"crypto/dsa" - //"crypto/ecdsa" - //"crypto/elliptic" - //"crypto/rsa" _ "crypto/sha1" _ "crypto/sha256" _ "crypto/sha512" - //"crypto/x509/pkix" "encoding/asn1" - //"encoding/pem" "errors" - //"fmt" - //"io" - //"math/big" - //"net" - //"net/url" - //"strconv" - //"strings" - //"time" - //"unicode/utf8" - // - //"golang_org/x/crypto/cryptobyte" - //cryptobyte_asn1 "golang_org/x/crypto/cryptobyte/asn1" ) // CreateCertificate creates a new X.509v3 certificate based on a template.