Coder Social home page Coder Social logo

Implement exludelist about go-appimage HOT 2 CLOSED

probonopd avatar probonopd commented on September 24, 2024
Implement exludelist

from go-appimage.

Comments (2)

probonopd avatar probonopd commented on September 24, 2024

Something along the lines of

// excluder project main.go
package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
	"strings"
)

func main() {
	excludedLibs := getExcludedLibs()
	fmt.Println(excludedLibs)
}

func getExcludedLibs() []string {

	var excludeListLibs []string

	url := "https://raw.githubusercontent.com/AppImage/pkg2appimage/master/excludelist"
	var client http.Client
	resp, err := client.Get(url)
	if err != nil {
		log.Fatal(err)
	}
	defer resp.Body.Close()
	var bodyString string
	if resp.StatusCode == http.StatusOK {
		bodyBytes, err := ioutil.ReadAll(resp.Body)
		if err != nil {
			log.Println(err)
			return (excludeListLibs)
		}
		bodyString = string(bodyBytes)
	} else {
		fmt.Println("Error getting excludelist")
		return (excludeListLibs)
	}

	lines := strings.Split(bodyString, "\n")

	for _, line := range lines {
		if strings.HasPrefix(line, "#") || line == "" {
			continue
		}
		line = strings.Split(line, "#")[0]
		excludeListLibs = append(excludeListLibs, strings.TrimSpace(line))
	}
	return (excludeListLibs)
}

from go-appimage.

probonopd avatar probonopd commented on September 24, 2024

Implemented

from go-appimage.

Related Issues (20)

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.