Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
20 changes: 20 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
changelog:
exclude:
labels:
- ignore-for-release
categories:
- title: Breaking Changes
labels:
- breaking-change
- title: New Features
labels:
- enhancement
- title: Bug Fixes
labels:
- bug
- title: Documentation
labels:
- documentation
- title: Other Changes
labels:
- "*"
63 changes: 63 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
name: build
on:
push:
tags:
- v*
branches:
- main
- master
pull_request:
permissions:
contents: write
pull-requests: read
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go:
- '1.17'
- '1.18'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
only-new-issues: true
- name: Test
run: go test -v -coverprofile=cover.out ./...
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: cover.out
flag-name: Go-${{ matrix.go }}
parallel: true
finish:
needs: build
runs-on: ubuntu-latest
steps:
- uses: shogo82148/actions-goveralls@v1
with:
parallel-finished: true
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.18'
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3.1.0
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13 changes: 13 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
linters:
enable-all: true
disable:
- exhaustivestruct
- exhaustruct
- godox
- goerr113
- gomnd
- ireturn
- nonamedreturns
- varnamelen
- wrapcheck
7 changes: 7 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
builds:
- skip: true
release:
prerelease: auto
changelog:
use: github-native
9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
[![Build Status](https://travis-ci.com/bodgit/windows.svg?branch=master)](https://travis-ci.com/bodgit/windows)
[![Coverage Status](https://coveralls.io/repos/github/bodgit/windows/badge.svg?branch=master)](https://coveralls.io/github/bodgit/windows?branch=master)
[![GitHub release](https://img.shields.io/github/v/release/bodgit/windows)](https://github.com/bodgit/windows/releases)
[![Build Status](https://img.shields.io/github/workflow/status/bodgit/windows/build)](https://github.com/bodgit/windows/actions?query=workflow%3Abuild)
[![Coverage Status](https://coveralls.io/repos/github/bodgit/windows/badge.svg?branch=main)](https://coveralls.io/github/bodgit/windows?branch=main)
[![Go Report Card](https://goreportcard.com/badge/github.com/bodgit/windows)](https://goreportcard.com/report/github.com/bodgit/windows)
[![GoDoc](https://godoc.org/github.com/bodgit/windows?status.svg)](https://godoc.org/github.com/bodgit/windows)
![Go version](https://img.shields.io/badge/Go-1.18-brightgreen.svg)
![Go version](https://img.shields.io/badge/Go-1.17-brightgreen.svg)

windows
=======

A collection of types native to Windows but are useful on non-Windows platforms.

The `FILETIME`-comparable type is the sole export which is a 1:1 copy of the one from `golang.org/x/sys/windows`. However, that package isn't available for all platforms and this particular type gets used in other protocols and file types such as NTLMv2 and 7-Zip.
The `FILETIME`-equivalent type is the sole export which is a 1:1 copy of the type found in the `golang.org/x/sys/windows` package. That package only builds on `GOOS=windows` and this particular type gets used in other protocols and file types such as NTLMv2 and 7-zip.
2 changes: 2 additions & 0 deletions filetime.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func (ft *Filetime) Nanoseconds() int64 {
nsec -= offset
// convert into nanoseconds
nsec *= 100

return nsec
}

Expand All @@ -38,5 +39,6 @@ func NsecToFiletime(nsec int64) (ft Filetime) {
// split into high / low
ft.LowDateTime = uint32(nsec & 0xffffffff)
ft.HighDateTime = uint32(nsec >> 32 & 0xffffffff)

return ft
}
8 changes: 5 additions & 3 deletions filetime_test.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
package windows
package windows_test

import (
"fmt"
"time"

"github.com/bodgit/windows"
)

func ExampleNsecToFiletime() {
ft := NsecToFiletime(time.Date(2020, 7, 20, 17, 15, 10, 0, time.UTC).UnixNano())
ft := windows.NsecToFiletime(time.Date(2020, 7, 20, 17, 15, 10, 0, time.UTC).UnixNano())

fmt.Println(ft)
// Output: {1384030976 30826169}
}

func ExampleFiletime_Nanoseconds() {
ft := Filetime{
ft := windows.Filetime{
1384030976,
30826169,
}
Expand Down