Coder Social home page Coder Social logo

trojan-go-libs's Introduction

igniter-go-libs

How to build

Prerequirements

Install Go

Please make sure you have at least Go 1.13 installed correctly

go version

You should see something like

go version go1.13.8 linux/amd64

Install and upgrade gomobile

In this example, We will install gomobile and its dependencies to $GOPATH.

You can find the executable in $GOPATH/bin, to make it easy to use, we add it to PATH.

To upgrade, re-run the install commands.

export GOPATH=$HOME/go
go get -u -d -v golang.org/x/mobile/cmd/gomobile
go build -a -v golang.org/x/mobile/cmd/gomobile
go install -v golang.org/x/mobile/cmd/gomobile
# Make sure we can execute gomobile and gobind directly
export PATH="$GOPATH/bin:$PATH"
# prepare gomobile component: gobind
gomobile init

Build

# If you cannot execute command, make sure your PATH is correct

# Point to your Android SDK root
# change to your installation configuration please
export ANDROID_HOME=/path/to/your/android/sdk

# Clone this repository
pushd /path/to/git/repository/just/cloned

make android

Development Guide

How to switch between local and remove module

If you want to say, point to the local version of a dependency in Go rather than the one over the web, use the replace keyword.

The replace line goes above your require statements, like so:

module github.com/person/foo

replace github.com/person/bar => /Users/person/Projects/bar

require (
	github.com/person/bar v1.0.0
)

And now when you compile this module (go install), it will use your local code rather than the other dependency.

According to the docs, you do need to make sure that the code you’re pointing to also has a go.mod file.

go mod edit -replace github.com/eycorsican/go-tun2socks=/path/to/my/local/github/igniter-deps/go-tun2socks

It looks everything is fine, we can push changes in your local repository to the remote one.

In this example, the commit we just pushed is efeee82.

To switch to the version over the web, a.k.a. the commit efeee82 from module github.com/trojan-gfw/go-tun2socks

go mod edit -replace github.com/eycorsican/go-tun2socks=github.com/trojan-gfw/go-tun2socks@efeee82

To check which dependency you are truely using:

go list -m all

How to make C/C++ source changes take effect

For go tools, e.g. gobind, it only check *.go file changes.

Please make sure to change at least one golang source by adding whitespaces or line breaks or whatever you like.

The go tools notify *.go changes, it will recompile the C/C++ sources.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.