Git Product home page Git Product logo

binclude's People

Contributors

audiolion avatar lu4p avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

binclude's Issues

Evaluate binclude.Include based on build tags

Is it possible to use binclude to selectively include files based on build tags? For instance, if I am building for windows amd64, include X file?

//+build windows

import "github.com/lu4p/binclude"

binclude.Include("/windows-thing.dll")

Include expects a constant string literal

I may be using the API incorrectly. binclude.Include always expects string literal.
binclude.Include(fmt.Sprintf("%s", "./out/myexe"))
Does not work and give error

[binclude] 2020/06/26 06:09:47 argument is not string literal

Is there a way to avoid this, I am looking for reading the file name from say input json

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

Generates \ slashes instead of /

I'm using windows 10 and the generated BinFS map has \ in it's keys as path seperator.
Generated error with value at that point \r: .\binclude.go:54:54: unknown escape sequence.

Remove support for Brotli

This is something I've never done before, an anti-feature request :)

You recently added optional GZip and Brotli support. They cover the same use case, with Brotli offering slightly better filesizes. Since Brotli isn't supported by Go by default, you had to pull in the github.com/andybalholm/brotli package. This package is anything but small:

❯ gocloc brotli
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Go                              61           2451           1941         252967
Plain Text                       1            815              0           8471
Markdown                         1              1              0              4
-------------------------------------------------------------------------------
TOTAL                           63           3267           1941         261442
-------------------------------------------------------------------------------

Is an optional feature worth adding 260k lines of code? I'd argue no. Furthermore, aletheia-icu/broccoli already covers the "embed files with brotli compression" use case, for those interested in it (and not afraid of the large dependency).

Allow direct `go generate` usage (no CLI)

Here's an official feature request, repeating what I said on Reddit:

 I would appreciate being able to run the generator from my own _gen.go file, instead of having to rely on the binclude binary (which requires ensuring I have installed it up front, and I guess maintaining a tools.go file for that purpose).

This would require moving the relevant code from cmd/bininclude to the parent package, so that it can be called both by random callers and the CLI.

Right now only vfsgen in the entire ecosystem supports this, so it would be a big plus for this package to cover it.

Binclude generated code doesn't always match go fmt

When I run binclude, some of the time the generated code does not match go fmt so I have to run go fmt against the file after generation. Specifically there is extra space between the variable declarations and the = sign that needs to be removed:

Current binclude generated output

image

After I run go fmt

image

os/exec wrapper caching

The os/exec wrapper is a really useful feature. As I understand the feature it copies the embedded byte slice to a temporary file in the os.CacheUserDir(), executes it, and then removes it. This is a sane default, but if the embedded binary is large (in my case, 80mb), this will take a long time to copy and use each time. I wonder if there should be an option to disable the removal, and a potential warning logged when calling os/exec on a large binary, or if this is a feature that people should just implement on their own (extracting the embedded file to wherever and calling os/exec on it). I can really see this -not- being a feature that is added, but if it is not, I wonder if there should be some documentation or warning that this could be expensive for large binaries because it copies them each time.

Does this works for binary files

I am trying for binary files, but I am always getting error


binclude.Include("./out/MyExe")

err := example.BinFS.CopyFile("MyExe", filepath.Join(destination, "MyExe"))
		if err != nil {
			fmt.Printf("1 :: Failed to copy file to destination, error = %v\n", err)
			//os.Exit(1)
		}
		err = example.BinFS.CopyFile("out/MyExe, filepath.Join(destination, "MyExe"))
		if err != nil {
			fmt.Printf("2 :: Failed to copy file to destination, error = %v\n", err)
			//os.Exit(1)
		}
		err = example.BinFS.CopyFile("./out/MyExe", filepath.Join(destination, "MyExe"))
		if err != nil {
			fmt.Printf("3 ::Failed to copy file to destination, error = %v\n", err)
			//os.Exit(1)
		}

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.