Socket
Socket
Sign inDemoInstall

github.com/dmotylev/goproperties

Package Overview
Dependencies
0
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/dmotylev/goproperties

Package goproperties implements read operations on .properties file. .properties is a file extension for files mainly used in Java related technologies to store the configurable parameters of an application. They can also be used for storing strings for Internationalization and localization; these are known as Property Resource Bundles. Each parameter is stored as a pair of strings, one storing the name of the parameter (called the key), and the other storing the value. Each line in a .properties file normally stores a single property. Several formats are possible for each line, including key=value, key = value, key:value, and key value. .properties files can use the number sign (#) or the exclamation mark (!) as the first non blank character in a line to denote that all text following it is a comment. The backwards slash is used to escape a character. An example of a properties file is provided below. In the example above, website would be a key, and its corresponding value would be http://en.wikipedia.org/. While the number sign and the exclamation mark marks text as comments, it has no effect when it is part of a property. Thus, the key message has the value Welcome to Wikipedia! and not Welcome to Wikipedia. Note also that all of the whitespace in front of Wikipedia! is excluded completely. The encoding of a .properties file is ISO-8859-1, also known as Latin-1. All non-Latin-1 characters must be entered by using Unicode escape characters, e. g. \uHHHH where HHHH is a hexadecimal index of the character in the Unicode character set. This allows for using .properties files as resource bundles for localization. A non-Latin-1 text file can be converted to a correct .properties file by using the native2ascii tool that is shipped with the JDK or by using a tool, such as po2prop, that manages the transformation from a bilingual localization format into .properties escaping. From Wikipedia, the free encyclopedia http://en.wikipedia.org/wiki/.properties


Version published

Readme

Source

Goproperties Build Status

Package implements read operations of .properties source.

Documentation

The Goproperties API reference is available on GoDoc.

Installation

Install Goproperties using the go get command:

go get -u github.com/dmotylev/goproperties

Usage

Example:

package main

import "github.com/dmotylev/goproperties"

func main() {
	p, _ := properties.Load("credentials")
	username := p.String("username","demo")
	password := p.String("password","demo")

	// ... use given credentials

	_, _ = username, password
}

Look at properties_test.go for more usage hints.

License

For the license see LICENSE.

FAQs

Last updated on 30 Jun 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc