Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
sawyer523 committed Nov 18, 2024
0 parents commit f3b313f
Show file tree
Hide file tree
Showing 47 changed files with 3,120 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/" # Don't change this despite the path being .github/workflows
schedule:
# Check for updates to GitHub Actions on the first day of the month
interval: "monthly"

- package-ecosystem: "gomod"
directory: "/"
schedule:
# Check for updates to Go modules on the first day of the month
interval: "monthly"
27 changes: 27 additions & 0 deletions .github/workflows/on-push-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: CI/CD
on:
push:
branches: [main]
tags: ["v*.*.*"]
pull_request:
types: [opened, reopened, synchronize]
jobs:
format-build-test:
strategy:
matrix:
go-version: ['1.21.x', '1.22.x']
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version: ${{ matrix.go-version }}

- if: matrix.platform == 'ubuntu-latest'
run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi

- run: go build -v ./...

- run: go test -cover -race -v ./...
33 changes: 33 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Reference https://github.com/github/gitignore/blob/master/Go.gitignore
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so

# OS General
Thumbs.db
.DS_Store

# project
*.log
bin/

# Develop tools
.vscode/
.idea/
.run
*.swp
logs
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 xiaonan chen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Go Plist library

[![CI/CD](https://github.com/micromdm/plist/workflows/CI%2FCD/badge.svg)](https://github.com/micromdm/plist/actions) [![Go Reference](https://pkg.go.dev/badge/github.com/micromdm/plist.svg)](https://pkg.go.dev/github.com/micromdm/plist)

This Plist library is used for decoding and encoding Apple Property Lists in both XML and binary forms.

Example using HTTP streams:

```go
func someHTTPHandler(w http.ResponseWriter, r *http.Request) {
var sparseBundleHeader struct {
InfoDictionaryVersion *string `plist:"CFBundleInfoDictionaryVersion"`
BandSize *uint64 `plist:"band-size"`
BackingStoreVersion int `plist:"bundle-backingstore-version"`
DiskImageBundleType string `plist:"diskimage-bundle-type"`
Size uint64 `plist:"unknownKey"`
Payload []any `plist:"payload"`
}

// decode an HTTP request body into the sparseBundleHeader struct
if err := plist.NewXMLDecoder(r.Body).Decode(&sparseBundleHeader); err != nil {
log.Println(err)
return
}
}
```

## Credit

This library is based on the [DHowett go-plist](https://github.com/DHowett/go-plist) library but has an API that is more like the XML and JSON package in the Go standard library. I.e. the `plist.Decoder()` accepts an `io.Reader` instead of an `io.ReadSeeker`
Loading

0 comments on commit f3b313f

Please sign in to comment.