1
0
mirror of https://github.com/chai2010/advanced-go-programming-book.git synced 2025-05-24 04:22:22 +00:00

add copyright

This commit is contained in:
chai2010 2018-01-09 16:24:22 +08:00
parent 4a31483164
commit f16ece9385
38 changed files with 113 additions and 0 deletions

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
package main package main
import "fmt" import "fmt"

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
package main package main
func main() func main()

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
#include "textflag.h" #include "textflag.h"
#include "funcdata.h" #include "funcdata.h"

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
package main package main
// #include <stdio.h> // #include <stdio.h>

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
#include <iostream> #include <iostream>
void SayHello() { void SayHello() {

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
// +build ignore // +build ignore
package main package main

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
%module main %module main
%inline %{ %inline %{

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
package main package main
import ( import (

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
package main package main
//#include <stdio.h> //#include <stdio.h>

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
package main package main
/* /*

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
#include <stdio.h> #include <stdio.h>
void SayHello(const char* s) { void SayHello(const char* s) {

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
package main package main
//void SayHello(const char* s); //void SayHello(const char* s);

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
package main package main
/* /*

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
package main package main
//void SayHello(char* s); //void SayHello(char* s);

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
package main package main
//#include <stdio.h> //#include <stdio.h>

View File

@ -1 +1,4 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
#include "./my_buffer.h" #include "./my_buffer.h"

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
package main package main
import "unsafe" import "unsafe"

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
#include <string> #include <string>
struct MyBuffer { struct MyBuffer {

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
#include "./my_buffer.h" #include "./my_buffer.h"
extern "C" { extern "C" {

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
package main package main
/* /*

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
typedef struct MyBuffer_T MyBuffer_T; typedef struct MyBuffer_T MyBuffer_T;
MyBuffer_T* NewMyBuffer(int size); MyBuffer_T* NewMyBuffer(int size);

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
package main package main
import ( import (

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
#include "person.h" #include "person.h"
#include <stdio.h> #include <stdio.h>

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
package main package main
// #cgo CXXFLAGS: -std=c++11 // #cgo CXXFLAGS: -std=c++11

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
package main package main
type Person struct { type Person struct {

View File

@ -1 +1,4 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
#include "person.h" #include "person.h"

View File

@ -1,3 +1,5 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
extern "C" { extern "C" {
#include "./person_capi.h" #include "./person_capi.h"

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
package main package main
//#include "./person_capi.h" //#include "./person_capi.h"

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
#include <stdint.h> #include <stdint.h>
typedef uintptr_t person_handle_t; typedef uintptr_t person_handle_t;

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
package main package main
import "C" import "C"

View File

@ -1,3 +1,6 @@
# Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
# License: https://creativecommons.org/licenses/by-nc-sa/4.0/
default: default:
go build -buildmode=c-shared -o gopkg.so main.go go build -buildmode=c-shared -o gopkg.so main.go
python3 -c 'import gopkg; print(gopkg.system("time"))' python3 -c 'import gopkg; print(gopkg.system("time"))'

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
package main package main
/* /*

View File

@ -1,3 +1,6 @@
# Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
# License: https://creativecommons.org/licenses/by-nc-sa/4.0/
default: default:
go build -buildmode=c-shared -o say-hello.so main.go go build -buildmode=c-shared -o say-hello.so main.go
gcc -Wall _test_so.c ./say-hello.so gcc -Wall _test_so.c ./say-hello.so

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
#include "say-hello.h" #include "say-hello.h"
#include <stdio.h> #include <stdio.h>

View File

@ -1,3 +1,6 @@
# Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
# License: https://creativecommons.org/licenses/by-nc-sa/4.0/
from ctypes import * from ctypes import *
libso = CDLL("./say-hello.so") libso = CDLL("./say-hello.so")

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
package main package main
import "C" import "C"

View File

@ -1,2 +1,5 @@
# Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
# License: https://creativecommons.org/licenses/by-nc-sa/4.0/
default: default:
go tool cgo hello.go go tool cgo hello.go

View File

@ -1,3 +1,6 @@
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
package main package main
import "C" import "C"