go Packed binary and lost permission to run on server

Viewed 33

Steps:

go build . /main.go
./main # run 
curl localhost:8080 # app run on 8080

The app exits with non-removable permissions attached

step image

I'm developing a go app for the first time if there is anything else I need to provide I will update the content as soon as possible, thanks

Because curl's is an unmatched route, we won't post the contoller code here

package main

import (
    "github.com/gin-gonic/gin"
    "example.app/common"
    "example.app/config"
    "example.app/controller"
    "example.app/db"
    "example.app/middleware"
)

func main() {
    config.Initialize()
    gin.SetMode(config.AppMode)

    r := gin.Default()
    r.SetTrustedProxies([]string{"::"})

    // setup auth middleware.
    r.Use(middleware.Auth())

    common.InitValidator()

    // setup routes.
    controller.Initialize(r) 

    r.Run(":" + config.AppPort)
}

go mode code

env

Linux instance-220907111205 4.15.0-22-generic #24-Ubuntu SMP Wed May 16 12:15:17 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
0 Answers
Related