Skip to content

Instantly share code, notes, and snippets.

View minux's full-sized avatar
💭
I will be extremely slow to respond.

Minux Ma minux

💭
I will be extremely slow to respond.
View GitHub Profile
@minux
minux / valgrind.log
Created February 10, 2017 12:04
valgrind on helloworld.go
==20053== Memcheck, a memory error detector
==20053== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==20053== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==20053== Command: /tmp/helloworld
==20053==
==20053== Warning: ignored attempt to set SIGRT32 handler in sigaction();
==20053== the SIGRT32 signal is used internally by Valgrind
==20053== Warning: client switching stacks? SP change: 0xffefffdd8 --> 0xc42002e7d8
==20053== to suppress, use: --max-stackframe=773647952384 or greater
==20053== Warning: client switching stacks? SP change: 0xc42002e780 --> 0xffefffe58
@minux
minux / gist:ef054728f5f9b8e3685b88f5c88d1ad3
Created December 3, 2016 01:52
runtime_os_darwin_print_bsdthread_register_error.patch
diff --git a/src/runtime/os_darwin.go b/src/runtime/os_darwin.go
index 1528167..edcb512 100644
--- a/src/runtime/os_darwin.go
+++ b/src/runtime/os_darwin.go
@@ -101,7 +101,8 @@ func goenvs() {
// but only if we're not using cgo. If we are using cgo we need
// to let the C pthread library install its own thread-creation callback.
if !iscgo {
- if bsdthread_register() != 0 {
+ if r := bsdthread_register(); r != 0 {
@minux
minux / gist:3d795d947440dfb15903
Created May 20, 2015 23:21
Run darwin/arm64 port natively patch
diff --git a/src/cmd/dist/util.go b/src/cmd/dist/util.go
index cae5d69..7acacd2 100644
--- a/src/cmd/dist/util.go
+++ b/src/cmd/dist/util.go
@@ -429,8 +429,11 @@ func main() {
case strings.Contains(out, "ppc64"):
gohostarch = "ppc64"
case gohostos == "darwin":
- if strings.Contains(run("", CheckExit, "uname", "-v"), "RELEASE_ARM_") {
+ ver := run("", CheckExit, "uname", "-v")
@minux
minux / gist:1bc4b50953e6c968ecb7
Created January 22, 2015 07:05
issue 9656: cmd/pack TestLargeDefs uses too much disk space
diff --git a/src/cmd/pack/pack.go b/src/cmd/pack/pack.go
index f65ae0c..90152af 100644
--- a/src/cmd/pack/pack.go
+++ b/src/cmd/pack/pack.go
@@ -426,20 +426,18 @@ func readPkgdef(file string) (data []byte, err error) {
// Read from file, collecting header for __.PKGDEF.
// The header is from the beginning of the file until a line
// containing just "!". The first line must begin with "go object ".
- rbuf := bufio.NewReader(f)
var wbuf bytes.Buffer
@minux
minux / git-coderevew.patch
Created January 15, 2015 09:21
git-codereview patch for go-zh Gerrit instance
diff --git a/git-codereview/api.go b/git-codereview/api.go
index ac61cba..4a67f33 100644
--- a/git-codereview/api.go
+++ b/git-codereview/api.go
@@ -41,15 +41,20 @@ func loadGerritOrigin() {
}
// Gerrit must be set as Git's origin remote.
- origin := getOutput("git", "config", "remote.origin.url")
+ origin := getOutput("git", "config", "remote.origin.pushurl")
@minux
minux / issue9410.patch
Last active August 29, 2015 14:12
Issue 9410
See https://golang.org/issue/9410
To be used with https://github.com/minux/swig/tree/go1.5.
diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go
index e201f29..3ae2f86 100644
--- a/src/cmd/go/build.go
+++ b/src/cmd/go/build.go
@@ -1827,7 +1827,7 @@ func (gcToolchain) ld(b *builder, p *Package, out string, allactions []*action,
}
@minux
minux / issue9355.patch
Created December 16, 2014 22:44
Issue 9355
diff --git a/src/cmd/6g/gsubr.c b/src/cmd/6g/gsubr.c
index 5bd9246..dae57af 100644
--- a/src/cmd/6g/gsubr.c
+++ b/src/cmd/6g/gsubr.c
@@ -1115,6 +1115,8 @@ void
naddr(Node *n, Addr *a, int canemitcode)
{
Sym *s;
+ Node *nn;
+ int64 oary[10];
@minux
minux / gist:c2b1c270ac1c7ea1a0cc
Created December 12, 2014 23:49
dashboard/builder: remove the repo export speed hack for hg
From 73e8a39c6f92390ffac7a2debc4f328c308a2147 Mon Sep 17 00:00:00 2001
From: Shenghou Ma <minux@golang.org>
Date: Fri, 12 Dec 2014 16:30:15 -0500
Subject: [PATCH] dashboard/builder: remove the repo export speed hack for hg
The builder will no longer generate a VERSION file, so we
can revert https://golang.org/cl/1405 once all builders
have updated.
Fixes golang/go#9296.
diff --git a/src/runtime/os1_nacl.go b/src/runtime/os1_nacl.go
index 0a446c4..7b1988e 100644
--- a/src/runtime/os1_nacl.go
+++ b/src/runtime/os1_nacl.go
@@ -46,11 +46,8 @@ func crash() {
*(*int32)(nil) = 0
}
-//go:nosplit
-func getRandomData(r []byte) {
@minux
minux / HOWTO_Convert_Go_Hg2Git
Last active August 29, 2015 14:11
convert Go repository from hg to git
assume the patched git is in git-2.2.0/, patched fast-export is at fast-export/ (git://repo.or.cz/fast-export.git)
The conversion command line is:
mkdir target
cd target
git init
PATH=../git-2.2.0:$PATH ../fast-export/hg-fast-export.sh -r /path/to/hg/repo --hgtags # --hgtags is very important.
Caveats:
Because during the history of go, there used to exist these two files: