How to convert Go Package into Xcode for iOS 8.3

What is Go language?


Go was designed to be a language that encourages smart code engineering practices. a very important a part of top quality code is code apply – embodied within the principle “Don't Repeat Yourself.”


As we have a tendency to saw in chapter seven functions ar the primary layer we have a tendency to address enable code apply. Go conjointly provides another mechanism for code reuse: packages. Nearly each program we have seen to this point enclosed this line:



import "fmt"
fmt is that the name of a package that has a range of functions associated with info and output to the screen. Bundling code during this method serves three purposes:


1. It reduces the prospect of getting overlapping names. This keeps our operate names short and compact


2. It organizes code in order that its easier to search out code you would like to apply.


3. It hastens the compiler by solely requiring recompilation of smaller chunks of a program. though we have a tendency to use the package fmt, we do not have to be compelled to recompile it each time we alter our program.



How to convert Go package into a Xcode for iOS 8.3.


Requirement




Steps:

1. Download and build the source of go 1.4 given below:
$ git clone https://go.googlesource.com/go $HOME/go1.4
$ cd $HOME/go1.4
$ git checkout go1.4.1
$ cd src && ./make.bash

2. Clone and build the source of go 1.5 given below:

$ git clone https://go.googlesource.com/go $HOME/go
$ cd $HOME/go/src && ./make.bash
$ export PATH=$PATH:$HOME/go/bin

3.Now build the cross compiler to convert the project

$ GOARM=7 CGO_ENABLED=1 GOARCH=arm CC_FOR_TARGET=`pwd`/../misc/ios/clangwrap.sh \
  CXX_FOR_TARGET=`pwd`/../misc/ios/clangwrap.sh ./make.bash
$ CGO_ENABLED=1 GOARCH=arm64 CC_FOR_TARGET=`pwd`/../misc/ios/clangwrap.sh \
  CXX_FOR_TARGET=`pwd`/../misc/ios/clangwrap.sh ./make.bash

4.Finally all things set up,Now clone the library and convert the go2 package into xCode

$ go get -d golang.org/x/mobile/example/basic
$ go2xcode golang.org/x/mobile/example/basic
$ cd xcode
$ xcodebuild # or open the Xcode project

 Note: go2xcode requires Go 1.5 darwin/arm and darwin/arm64 cross compilers. In order to build these cross compilers, you need to Go 1.5 sourceand For building the Go 1.5 requires Go 1.4 




Also see:












6.HOW APPLE REBUILT SIRI ON MESOS