code stringlengths 10 1.34M | language stringclasses 1
value |
|---|---|
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test composite literals.
package main
type T struct {
i int
f float64
s string
next *T
}
type R struct {
num int
}
func itor(a int)... | Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test literal syntax for basic types.
package main
var nbad int
func assert(cond bool, msg string) {
if !cond {
if nbad == 0 {
print("BUG")
... | Go |
// run
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test reorderings; derived from fixedbugs/bug294.go.
package main
var log string
type TT int
func (t TT) a(s string) TT {
log += "a(" + s + ")"
... | Go |
// errorcheck
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Verify that illegal character literals are detected.
// Does not compile.
package main
const (
// check that surrogate pair elements are in... | Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test defer.
package main
import "fmt"
var result string
func addInt(i int) { result += fmt.Sprint(i) }
func test1helper() {
for i := 0; i < 10;... | Go |
// cmpout
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test that we can defer the predeclared functions print and println.
package main
func main() {
defer println(42, true, false, true, 1.5, "worl... | Go |
// run
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test that the implementation catches nil ptr indirection
// in a large address space.
package main
import "unsafe"
// Having a big address space ... | Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test methods on slices.
package main
type T []int
func (t T) Len() int { return len(t) }
type I interface {
Len() int
}
func main() {
var t T ... | Go |
// run
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test of recover for run-time errors.
// TODO(rsc):
// null pointer accesses
package main
import "strings"
var x = make([]byte, 10)
func main() ... | Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test that the Go environment variables are present and accessible through
// package os and package runtime.
package main
import (
"os"
"runtime"... | Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test various safe uses of indirection.
package main
var m0 map[string]int
var m1 *map[string]int
var m2 *map[string]int = &m0
var m3 map[string]int... | Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Simple test of the garbage collector.
package main
import "runtime"
func mk2() {
b := new([10000]byte)
_ = b
// println(b, "stored at", &b)
}
... | Go |
// errorcheck
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test that basic operations on named types are valid
// and preserve the type.
// Does not compile.
package main
type Bool bool
type Map ma... | Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test simple functions.
package main
func assertequal(is, shouldbe int, msg string) {
if is != shouldbe {
print("assertion fail", msg, "\n")
pa... | Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test simple type switches on basic types.
package main
import "fmt"
const (
a = iota
b
c
d
e
)
var x = []int{1, 2, 3}
func f(x int, len *by... | Go |
// errorcheck
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test illegal shifts.
// Issue 1708, illegal cases.
// Does not compile.
package p
func f(x int) int { return 0 }
func g(x interface... | Go |
// errorcheck
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Verify assignment rules are enforced by the compiler.
// Does not compile.
package main
type (
A [10]int
B []int
C chan int
F func() int... | Go |
// run
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test of basic recover functionality.
package main
import "runtime"
func main() {
test1()
test1WithClosures()
test2()
test3()
test4()
test5(... | Go |
// errorcheck
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test that incorrect uses of the blank identifer are caught.
// Does not compile.
package _ // ERROR "invalid package name _"
func main() {
... | Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test the 'for range' construct.
package main
// test range over channels
func gen(c chan int, lo, hi int) {
for i := lo; i <= hi; i++ {
c <- i
... | Go |
// $G $D/method4a.go && $G $D/$F.go && $L $F.$A && ./$A.out
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test method expressions with arguments.
package main
import "./method4a"
type T1 int
type T2... | Go |
// runoutput
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Generate test of 64-bit arithmetic.
// Most synthesized routines have different cases for
// constants vs variables and even the generated code... | Go |
// errorcheck
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Verify that invalid imports are rejected by the compiler.
// Does not compile.
package main
// Correct import paths.
import _ "fmt"
import _... | Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test string literal syntax.
package main
import "os"
var ecode int
func assert(a, b, c string) {
if a != b {
ecode = 1
print("FAIL: ", c, ":... | Go |
// errorcheck
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Verify that illegal uses of indirection are caught by the compiler.
// Does not compile.
package main
var m0 map[string]int
var m1 *map[stri... | Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test implicit and explicit conversions of constants.
package main
const (
ci8 = -1 << 7
ci16 = -1<<15 + 100
ci32 = -1<<31 + 100000
ci64 = -1<<... | Go |
// [ "$GORUN" == "" ] || exit 0 # Android runner gets confused by the NUL output
// $G $D/$F.go && $L $F.$A && ./$A.out >tmp.go &&
// errchk $G -e tmp.go
// rm -f tmp.go
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LI... | Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test if statements in various forms.
package main
func assertequal(is, shouldbe int, msg string) {
if is != shouldbe {
print("assertion fail", m... | Go |
// cmpout
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test that big numbers work as constants and print can print them.
package main
func main() {
print(-(1<<63), "\n")
print((1<<63)-1, "\n")
}
| Go |
// errorcheck
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Verify allowed and disallowed conversions.
// Does not compile.
package main
// everything here is legal except the ERROR line
var c chan i... | Go |
// compile
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test that a comment ending a source file does not need a final newline.
// Compiles but does not run.
package eof1
// No newline at the end of... | Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Internally a map holds elements in up to 255 bytes of key+value.
// When key or value or both are too large, it uses pointers to key+value
// instead... | Go |
// $G $D/$F.go && $L $F.$A &&
// ./$A.out >tmp.go && $G tmp.go && $L -o $A.out1 tmp.$A && ./$A.out1
// rm -f tmp.go $A.out1
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Generate test of shift and rota... | Go |
// errorcheck
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test methods derived from embedded interface and *interface values.
package main
import "os"
const Value = 1e12
type Inter interface { M()... | Go |
// skip # used by recursive2
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Mutually recursive type definitions imported and used by recursive1.go.
package p
type I1 interface {
F() I2
}
type I2 int... | Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test static interface conversion of interface value nil.
package main
type R interface { R() }
type RW interface { R(); W() }
var e interface {}
v... | Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test interface methods with different return types are distinct.
package main
type S struct { a int }
type T struct { b string }
func (s *S) Name(... | Go |
// $G $D/recursive1.go && $G $D/$F.go
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test that the mutually recursive types in recursive1.go made it
// intact and with the same meaning, by assigning to ... | Go |
// skip # used by embed1.go
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test that embedded interface types can have local methods.
package p
type T int
func (t T) m() {}
type I interface { m() }
ty... | Go |
// compile
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Check mutually recursive interfaces
package recursive
type I1 interface {
foo() I2
}
type I2 interface {
bar() I1
}
type T int
func (t T) f... | Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test static interface conversion of interface value nil.
package main
type R interface { R() }
type RW interface { R(); W() }
var e interface {}
v... | Go |
// errorcheck
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Verify compiler complains about missing implicit methods.
// Does not compile.
package main
type T int
func (t T) V()
func (t *T) P()
type... | Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test Implicit methods for embedded types and
// mixed pointer and non-pointer receivers.
package main
type T int
var nv, np int
func (t T) V() {
... | Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test interface values containing structures.
package main
import "os"
var fail int
func check(b bool, msg string) {
if (!b) {
println("failure... | Go |
// $G $D/embed0.go && $G $D/$F.go && $L $F.$A && ./$A.out
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test that embedded interface types can have local methods.
package main
import "./embed0"
type ... | Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test all the different interface conversion runtime functions.
package main
type Stringer interface {
String() string
}
type StringLengther interf... | Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test that interface conversion fails when method is missing.
package main
type I interface {
Foo()
}
func main() {
shouldPanic(p1)
}
func p1() ... | Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test interface comparisons using types hidden
// inside reflected-on structs.
package main
import "reflect"
type T struct {
F float32
G float32
... | Go |
// skip # used by private.go
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Imported by private.go, which should not be able to see the private method.
package p
type Exported interface {
private()
}
... | Go |
// run
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test run-time error detection for interface values containing types
// that cannot be compared for equality.
package main
func main() {
cmp(1)
... | Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test big vs. small, pointer vs. value interface methods.
package main
type I interface { M() int64 }
type BigPtr struct { a, b, c, d int64 }
func ... | Go |
// $G $D/${F}1.go && errchk $G $D/$F.go
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test that unexported methods are not visible outside the package.
// Does not compile.
package main
import "./priv... | Go |
// errorcheck
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Verify compiler messages about erroneous static interface conversions.
// Does not compile.
package main
type T struct {
a int
}
var t *T
... | Go |
// errorcheck
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test that interface{M()} = *interface{M()} produces a compiler error.
// Does not compile.
package main
type Inst interface {
Next() *Inst
... | Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test methods derived from embedded interface values.
package main
import "os"
const Value = 1e12
type Inter interface { M() int64 }
type T int64... | Go |
// cmpout
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test that we can do page 1 of the C book.
package main
func main() {
print("hello, world\n")
}
| Go |
// run
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Test range over strings.
package main
import (
"fmt"
"os"
"unicode/utf8"
)
func main() {
s := "\000\123\x00\xca\xFE\u0123\ubabe\U0000babe\U001... | Go |
// $G $D/empty.go && errchk $G $D/$F.go
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Verify that various kinds of "imported and not used"
// errors are caught by the compiler.
// Does not compile.
pac... | Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import "swig/file"
func main() {
file.Puts("Hello, world")
}
| Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"fmt"
"swig/callback"
)
type GoCallback struct{}
func (p *GoCallback) Run() string {
return "GoCallback.Run"
}
func main() {
c :=... | Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"bytes"
"encoding/xml"
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
"regexp"
"runtime"
"strconv"
"strings"
"time"
)
... | Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
"log"
"net/http"
"net/url"
"time"
)
type obj map[string]interface{}
// dash runs t... | Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"bytes"
"io"
"log"
"os"
"os/exec"
)
// run is a simple wrapper for exec.Run/Close
func run(envv []string, dir string, argv ...strin... | Go |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/*
Go Builder is a continuous build client for the Go project.
It integrates with the Go Dashboard AppEngine application.
Go Builder is intended to run conti... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package dashboard
// This file handles receiving mail.
import (
"net/http"
"net/mail"
"regexp"
"time"
"appengine"
"appengine/datastore"
)
func init() ... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package dashboard
// This file handles identities of people.
import (
"sort"
)
var (
emailToPerson = make(map[string]string) // email => person
preferred... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package dashboard
// This file handles operations on the CL entity kind.
import (
"bytes"
"encoding/json"
"fmt"
"html/template"
"io"
"io/ioutil"
"net/h... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package dashboard
// This file handles the front page.
import (
"bytes"
"html/template"
"io"
"net/http"
"sync"
"time"
"appengine"
"appengine/datastor... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package dashboard
// This file handles garbage collection of old CLs.
import (
"net/http"
"time"
"appengine"
"appengine/datastore"
)
func init() {
http... | Go |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package stdio
/*
#include <stdio.h>
extern FILE __sF[3];
*/
import "C"
import "unsafe"
var Stdout = (*File)(unsafe.Pointer(&C.__sF[1]))
var Stderr = (*File)... | Go |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
package main
import "../stdio"
func main() {
stdio.Stdout.WriteString(stdio.Greeting + "\n")
}
| Go |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !netbsd
package stdio
/*
#include <stdio.h>
*/
import "C"
var Stdout = (*File)(C.stdout)
var Stderr = (*File)(C.stderr)
| Go |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/*
A trivial example of wrapping a C library in Go.
For a more complex example and explanation,
see ../gmp/gmp.go.
*/
package stdio
/*
#include <stdio.h>
#in... | Go |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
// Compute Fibonacci numbers with two goroutines
// that pass integers back and forth. No actual
// concurrency, just threads and synchroniz... | Go |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
// Pass numbers along a chain of threads.
package main
import (
"../stdio"
"runtime"
"strconv"
)
const N = 10
const R = 5
func link(le... | Go |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
// Run the game of life in C using Go for parallelization.
package main
import (
"."
"flag"
"fmt"
)
const MAXDIM = 100
var dim = flag.... | Go |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package life
// #include "life.h"
import "C"
import "unsafe"
func Run(gen, x, y int, a []int) {
n := make([]int, x*y)
for i := 0; i < gen; i++ {
C.Step(... | Go |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// This file contains test cases for cgo.
package cgotest
/*
// issue 1222
typedef union {
long align;
} xxpthread_mutex_t;
struct ibv_async_event {
union... | Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package cgotest
// const char *greeting = "hello, world";
import "C"
import (
"reflect"
"testing"
"unsafe"
)
const greeting = "hello, world"
type testPa... | Go |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// This file contains test cases for cgo.
package cgotest
/*
int base_symbol = 0;
#define alias_one base_symbol
#define alias_two base_symbol
*/
import "C"
... | Go |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Basic test cases for cgo.
package cgotest
/*
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <errno.h>
#define SHIFT(x, y) ((x)<<(... | Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package cgotest
/*
#include <windows.h>
unsigned int sleep(unsigned int seconds) {
Sleep(1000 * seconds);
return 0;
}
*/
import "C"
| Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package cgotest
import "C"
//export exportbyte
func exportbyte() byte {
return 0
}
//export exportbool
func exportbool() bool {
return false
}
//export e... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package backdoor
func LockedOSThread() bool // in runtime.c
| Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package cgotest
/*
#include <unistd.h>
unsigned int sleep(unsigned int seconds);
extern void BackgroundSleep(int);
void twoSleep(int);
*/
import "C"
import... | Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package cgotest
/*
void callback(void *f);
void callGoFoo(void);
*/
import "C"
import (
"./backdoor"
"runtime"
"testing"
"unsafe"
)
// nestedCall calls i... | Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package cgotest
import "testing"
// extern void BackIntoGo(void);
// void IntoC(void);
import "C"
//export BackIntoGo
func BackIntoGo() {
x := 1
for i :=... | Go |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package cgotest
/*
#include <stdio.h>
typedef unsigned char Uint8;
typedef unsigned short Uint16;
typedef enum {
MOD1 = 0x0000,
MODX = 0x8000
} SDLMod;
ty... | Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package cgotest
/*
#include <stdlib.h>
*/
import "C"
import (
"os"
"runtime"
"testing"
"unsafe"
)
// This is really an os package test but here for conven... | Go |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package cgotest
import "C"
//export exportSliceIn
func exportSliceIn(s []byte) bool {
return len(s) == cap(s)
}
//export exportSliceOut
func exportSliceOut... | Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package cgotest
import "C"
//export ReturnIntLong
func ReturnIntLong() (int, C.long) {
return 1, 2
}
| Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
package main
import "."
func main() {
cgosotest.Test()
}
| Go |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package cgosotest
/*
#cgo LDFLAGS: -L. -lcgosotest
void sofunc(void);
*/
import "C"
func Test() {
C.sofunc()
}
//export goCallback
func goCallback() {
}
| Go |
// +build ignore
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributio... | Go |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/*
An example of wrapping a C library in Go. This is the GNU
multiprecision library gmp's integer type mpz_t wrapped to look like
the Go package big's integer ... | Go |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
// Compute Fibonacci numbers with two goroutines
// that pass integers back and forth. No actual
// concurrency, just threads and synchroniz... | Go |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"bytes"
"flag"
"io/ioutil"
"log"
"net/http"
"os"
"os/exec"
"path/filepath"
"regexp"
"runtime"
"strconv"
"text/template"
)
v... | Go |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Goplay is a web interface for experimenting with Go code.
// It is similar to the Go Playground: http://golang.org/doc/play/
//
// To use goplay:
// $ cd... | Go |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/*
8l is the linker for the 32-bit x86.
The $GOARCH for these tools is 386.
The flags are documented in ../ld/doc.go.
*/
package documentation
| Go |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/*
5l is the linker for the ARM.
The $GOARCH for these tools is arm.
The flags are documented in ../ld/doc.go.
*/
package documentation
| Go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.