Follow below steps for creating go library

One time Setup:
	1. Install golang version 1.17.13 (https://go.dev/dl/go1.17.13.linux-amd64.tar.gz)
	untar it under /usr/local/
	create /root/go folder and make following subfolders under it
	bin  pkg  src

	2. setup environment variables GOROOT(/usr/local/go) and GOPATH(/root/go/). Make them under ~/.bashrc

	3. export GO111MODULE="off"

	4. copy gitlab folder goagent/cavgoutility under /usr/local/go/src

	5. Setup each framework by running given commands
	cd /root/go/src

	framework - echo
	go get github.com/labstack/echo
	mv github.com/labstack /usr/local/go/src/github.com
	git checkout tags/v4.6.1

	either replace /usr/local/go/src/github.com/labstack by goAgent/gopackages/labstack or merge following files

	bind.go
	context.go
	echo.go
	response.go

	framework - chi
	go get github.com/go-chi/chi
	mv github.com/go-chi /usr/local/go/src/github.com
	git checkout tags/v5.0.7
	replace /usr/local/go/src/github.com/go-chi by goAgent/gopackages/go-chi or merge following files
	chi.go
	mux.go
	tree.go


	framework - gin
	go get github.com/gin-gonic/gin
	mv github.com/gin-gonic /usr/local/go/src/github.com
	git checkout tags/v1.7.1
	replace /usr/local/go/src/github.com/gin-gonic by goAgent/gopackages/gin-gonic or merge following files
	context.go
	debug.go
	response_writer.go
	tree.go


	framework - pg
	go get github.com/go-pg/pg
	mv github.com/go-pg /usr/local/go/src/github.com
	git checkout tags/v10.10.6


	framework - sql
	go get github.com/go-sql-driver/mysql
	mv github.com/go-sql-driver /usr/local/go/src/github.com
	git checkout tags/v1.6.0


	framework - mongo
	go get go.mongodb.org/mongo-driver/bson
	go get go.mongodb.org/mongo-driver/event
	go get go.mongodb.org/mongo-driver/mongo

	go to go.mongodb.org/mongo-driver and type
	mv go.mongodb.org /usr/local/go/src/
	git checkout tags/v1.8.1

	replace /usr/local/go/src/go.mongodb.org by goAgent/gopackages/go.mongodb.org or merge following files
	event/monitoring.go
	mongo/options/clientoptions.go


	framework - httprouter
	go get github.com/julienschmidt/httprouter
	mv github.com/julienschmidt /usr/local/go/src/github.com
	git checkout tags/v1.3.0

	replace /usr/local/go/src/github.com/julienschmidt by goAgent/gopackages/julienschmidt or merge following files
	router.go
	tree.go


	framework - negroni
	go get github.com/urfave/negroni
	mv github.com/urfave /usr/local/go/src/github.com
	git checkout tags/v2.0.2

	framework - gorilla
	go get github.com/gorilla/mux
	mv github.com/gorilla /usr/local/go/src/github.com
	git checkout tags/v1.8.0

	replace /usr/local/go/src/github.com/gorilla by goAgent/gopackages/gorilla or merge following files
	middleware.go
	mux.go
	regexp.go
	route.go


	framework - gocql
	go get github.com/gocql/gocql
	mv github.com/gocql /usr/local/go/src/github.com
	git checkout tags/v1.0.0

	replace /usr/local/go/src/github.com/gocql by goAgent/gopackages/gocql or merge following files
	cluster.go
	conn.go

	framework - fiber
	go get github.com/gofiber/fiber
	mv github.com/gofiber /usr/local/go/src/github.com
	git checkout tags/v2.23.0

	replace /usr/local/go/src/github.com/gofiber by goAgent/gopackages/gofiber or merge following files
	app.go
	ctx.go
	group.go
	helpers.go
	path.go
	router.go

	fasthttp
	mv github.com/valyaya /usr/local/go/src/github.com
	git checkout tags/v1.31.0
	copy following folders from goAgent/gopackages/valyaya to /usr/local/go/src/github.com/
	args.go


	copy emirpasic from goAgent/gopackages/ to /root/go/src/github.com

	copy google2 to /usr/local/go/src/github.com/

	edit github.com/vmihailenco/tagparser/types.go and replace "github.com/vmihailenco/tagparser/v2" by "github.com/vmihailenco/tagparser"

	for vmihailenco/tagparser use following command
	git checkout tags/v0.1.2
	add following function in tagparser.go if not already there
	func Unquote(s string) (string, bool) {
        const quote = '\''

        if len(s) < 2 {
                return s, false
        }
        if s[0] == quote && s[len(s)-1] == quote {
                return s[1 : len(s)-1], true
        }
        return s, false
	}

	for github.com/rsc/letsencrypt
	git checkout tags/v0.0.1

Steps to create cavwrapperlib.so and its dependent libraries:
1. copy the contents of prod-src/core/netdiagnosticsagent/goAgent/gopackages/github into /usr/local/go/src/github.com/
   copy prod-src/core/netdiagnosticsagent/goAgent/gopackages/go.mongodb.org into /usr/local/go/src/
2. copy prod-src/core/netdiagnosticsagent/goAgent/cavwrapperlib/cavPlugin.go to /root/go/src
3. copy prod-src/core/netdiagnosticsagent/goAgent/cavgoutility into /usr/local/go/src/
4. use following commands to create the libraries

cd /root/go/src

rm -rf ../pkg/linux_amd64_dynlink/; rm -rf /usr/local/go/pkg/linux_amd64_dynlink/;

go15
	go install -linkshared -buildmode=shared github.com/gin-gonic/gin/ github.com/go-chi/chi github.com/gocql/gocql/ 
	github.com/gorilla/mux/ github.com/go-sql-driver/mysql/ net/http/ database/sql/ github.com/labstack/echo/ log/

go 16/17
	go install -linkshared -buildmode=shared github.com/gin-gonic/gin/ github.com/go-chi/chi github.com/gocql/gocql/ 
	github.com/gorilla/mux/ github.com/go-sql-driver/mysql/ database/sql/ github.com/labstack/echo/ github.com/go-pg/pg

go install -linkshared -buildmode=shared github.com/urfave/negroni/ github.com/julienschmidt/httprouter/ 
go.mongodb.org/mongo-driver/bson/ go.mongodb.org/mongo-driver/event/ go.mongodb.org/mongo-driver/mongo/options github.com/gofiber/fiber/ google.golang.org/grpc

go build -linkshared -buildmode=plugin -o libcavwrapperlib.so cavPlugin.go

copy /usr/local/go/pkg/linux_amd64_dynlink/libgithub.com-* and libcavwrapperlib.so to netdiagnosticsagent/goAgent/go/lib and commit.
