platform

package
v2.1.2+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2019 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Overview

Package platform provides build options for different platforms. This requires an external C library that our partners won't have, so this file is not compiled when the flag -tags=partners

Index

Constants

This section is empty.

Variables

View Source
var IsPartnerBuild = false

IsPartnerBuild will be true when we're building partner tools, and false otherwise.

Functions

func FileOwnerAndGroup

func FileOwnerAndGroup(finfo os.FileInfo) (uid int, gid int)

A late addition. Allows us to build apt_validate on all platforms.

func GetMountPointFromPath

func GetMountPointFromPath(path string) (string, error)

On Linux and OSX, this uses df in a safe way (without passing through any user-supplied input) to find the mountpoint of a given file.

func GetOwnerAndGroup

func GetOwnerAndGroup(finfo os.FileInfo, header *tar.Header)

We have a dummy version of this call in posix.go. Windows does not implement the syscall.Stat_t type we need, but the *nixes do. We use this in util.AddToArchive to set owner/group on files being added to a tar archive.

func GuessMimeType

func GuessMimeType(absPath string) (mimeType string, err error)

GuessMimeType uses the Mime Magic library to figure out the mime type of the file at absPath. If this can't figure out the mime type, it returns "application/binary".

func GuessMimeTypeByBuffer

func GuessMimeTypeByBuffer(buf []byte) (mimeType string, err error)

GuessMimeTypeByBuffer uses the Mime Magic library to figure out the mime type of the file by examining the first N bytes (however long buffer is). Use this for very large files, when you don't want GuessMimeType to try to read the whole file. Usually, the first few bytes are sufficient for buf. If this can't figure out the mime type, it returns "application/binary".

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL