Linux UDisks2 (dbus) easy access from Go

udisks

udisks gives you high level access to Linux system drives and block devices wrapping the udisk2 interfaces.

An example command line udisks client to list drives and block device properties can be installed with:

go install github.com/rubiojr/go-udisks/cmd/udisks@latest
package main

import (
	"encoding/json"
	"fmt"

	"os"

	"github.com/rubiojr/go-udisks"
)

func main() {
	client, err := udisks.NewClient()
	if err != nil {
		panic(err)
	}

	// List all block devices available to UDisks2
	devs, err := client.BlockDevices()
	if err != nil {
		panic(err)
	}
	pretty(devs)
}

func pretty(dev interface{}) {
	prettyString, _ := json.MarshalIndent(dev, "", "  ")
	fmt.Println(string(prettyString))
}
Owner
Sergio Rubio
Old School Graffiti Artist
Sergio Rubio
Similar Resources

Graphical small-internet client for windows, linux, MacOS X and BSDs. Supports gemini, http, https, gopher, finger.

Graphical small-internet client for windows, linux, MacOS X and BSDs. Supports gemini, http, https, gopher, finger.

Graphical small-internet client for windows, linux, MacOS X and BSDs. Supports gemini, http, https, gopher, finger.

Jan 1, 2023

Apptainer: Application containers for Linux

Apptainer NOTE: The apptainer repo is currently working towards a v1.0.0 release and not ready for production in its current state. Until then, use th

Jan 6, 2023

Monitor usb hotplug events (Linux)

USBMon Thin udev wrapper to simplify usb device add/remove monitoring. // monitor USB hotplug events package main import ( "context" "fmt" "githu

Aug 1, 2022

An easy way to add useful startup banners into your Go applications

An easy way to add useful startup banners into your Go applications

Try browsing the code on Sourcegraph! Banner Add beautiful banners into your Go applications Table of Contents Motivation Usage API Command line flags

Jan 1, 2023

:sunglasses:Package captcha provides an easy to use, unopinionated API for captcha generation

Package captcha provides an easy to use, unopinionated API for captcha generation. Why another captcha generator? I want a simple and framework-indepe

Dec 28, 2022

An easy to use, extensible health check library for Go applications.

Try browsing the code on Sourcegraph! Go Health Check An easy to use, extensible health check library for Go applications. Table of Contents Example M

Dec 30, 2022

safe and easy casting from one type to another in Go

cast Easy and safe casting from one type to another in Go Don’t Panic! ... Cast What is Cast? Cast is a library to convert between different go types

Jan 7, 2023

Easy environment variables for Go

env Easy environment variables for Go Usage import "github.com/darkhelmet/env" ... s := env.String("USER") // Will panic if USER is not present sd :

Dec 21, 2018

Yubigo is a Yubikey client API library that provides an easy way to integrate the Yubico Yubikey into your existing Go-based user authentication infrastructure.

yubigo Yubigo is a Yubikey client API library that provides an easy way to integrate the Yubikey into any Go application. Installation Installation is

Oct 27, 2022
Get user-like access to VirtualBox VMs from Go code.

#Vboxgo Get user-like access to VirtualBox VMs from Go code. This library wraps some define-tainted VirtualBox SDK functions, making it possible to ge

Oct 25, 2021
An example client implementation written in GO to access the CyberVox platform API

About This is an example client implementation written in GO to access the CyberVox platform API.

Nov 7, 2022
A limited Flow Access API which runs outside of the Flow Network using the DPS

Access API Flow DPS implements the Flow Access API Specification, except for the following endpoints: SendTransaction GetLatestProtocolStateSnapshot G

Jul 28, 2022
Record CS knowlegement with XMind, version 2.0. 使用 XMind 记录 Linux 操作系统,网络,C++,Golang 以及数据库的一些设计
Record CS knowlegement with XMind, version 2.0. 使用 XMind 记录 Linux 操作系统,网络,C++,Golang 以及数据库的一些设计

Psyduck 另一个用 XMind 记录 CS 基础问题的地方,同样提供了 .xmind 源文件以及导出的 .pdf 文件,XMind 版本为「XMind 2020」。 在 2020 年时,曾花了约 2 个月的时间整理了第一份 XMind 知识库: ZeroMind。 之所以额外创建一个 Repo

Dec 30, 2022
Lima launches Linux virtual machines on macOS, with automatic file sharing, port forwarding, and containerd.

Lima: Linux-on-Mac ("macOS subsystem for Linux", "containerd for Mac")

Jan 8, 2023
Nintendo Switch Joycon keyboard mapper for Linux

joygo Nintendo Switch Joycon keyboard mapper for Linux First, build with -> chmod +x build && ./build Then pair your Joycons to your computer via Blue

Nov 13, 2021
Linux namespace with golang

Linux namespace with golang

Nov 10, 2021
Testing the use of a golang wrapper around UserMode Linux for making stdin

This code is for testing the use of a golang wrapper around UserMode Linux for making stdin, stdout and stderr available to attach, detach and reattach to from the host using Unix sockets.

Dec 24, 2021
Script that sets your nzxt kraken temps based on cpu temps on linux

liquidctl-cpu-temp Script that monitors cpu temps and sets cpu cooler temps according to entered fan/pump curves. Only tested on NZXT kraken z63 requi

Nov 16, 2021
An experimental vulkan 3d engine for linux (raspberry 4)

protomatter an experimental vulkan 3d engine for linux (raspberry 4).

Nov 14, 2021