Giter VIP home page Giter VIP logo

Comments (2)

rkruetli avatar rkruetli commented on July 21, 2024

I'll have a look into it, strange that the binary version behafes different... as fare as I know is go run also compiled and executed...

from proxy-request-checker.

danieljancar avatar danieljancar commented on July 21, 2024

Hey @rkruetli

I'll have a look into it, strange that the binary version behafes different... as fare as I know is go run also compiled and executed...

You're right, when running the built binary from the project's root, it works. Sadly, when moving the executable proxy-checker.exe to another folder or executing it from a different path, it obviously can' find the config or report folder which is found at the project's root.
So either, running the binary from somewhere else isn't an option or we need to implement a workaround.


Success

  1. Building a binary from project root
$ go build -o proxy-checker cmd/main.go
  1. Executing the proxy-checker from project root, since it got saved there
$ ./proxy-checker 
2024/01/15 11:32:16 Requesting https://google.com
2024/01/15 11:32:16 Requesting https://dev.to
2024/01/15 11:32:16 Requesting https://css.ch
2024/01/15 11:32:16 Requesting https://slack.com

Fail

  1. Fails when running the binary from different path then project root
$  ./go-proxy-request-checker/proxy-checker 
2024/01/15 11:38:34 Error reading json file: open config/links.json: no such file or directory. Using default values...
2024/01/15 11:38:34 Requesting https://www.google.com
2024/01/15 11:38:34 Requesting https://www.slack.com

Solution

  • Export the configs on build time into the binary, meaning they can't be changed afterwards.
  • Make binary request a proper config file, from a constant path, before executing (environment_variables, etc.).

from proxy-request-checker.

Related Issues (7)

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.