Skip to content

Commit

Permalink
Updated config and cleaned up code
Browse files Browse the repository at this point in the history
  • Loading branch information
matfax committed Aug 2, 2018
1 parent ae4d690 commit a91d253
Show file tree
Hide file tree
Showing 14 changed files with 206 additions and 66 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ $RECYCLE.BIN/
*.dll
*.so
*.dylib
vendor/

# Test binary, build with `go test -c`
*.test
Expand Down
8 changes: 8 additions & 0 deletions .idea/afero.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

111 changes: 111 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 50 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"


[[constraint]]
name = "cloud.google.com/go"
version = "0.25.0"

[[constraint]]
name = "github.com/pkg/sftp"
version = "1.8.1"

[[constraint]]
name = "github.com/spf13/afero"
version = "1.1.1"

[[constraint]]
branch = "master"
name = "github.com/zatte/afero"

[[constraint]]
branch = "master"
name = "golang.org/x/net"

[[constraint]]
name = "golang.org/x/text"
version = "0.3.0"

[[constraint]]
branch = "master"
name = "google.golang.org/api"
48 changes: 9 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

A FileSystem Abstraction System for Go

[![Build Status](https://travis-ci.org/spf13/afero.svg)](https://travis-ci.org/spf13/afero) [![Build status](https://ci.appveyor.com/api/projects/status/github/spf13/afero?branch=master&svg=true)](https://ci.appveyor.com/project/spf13/afero) [![GoDoc](https://godoc.org/github.com/spf13/afero?status.svg)](https://godoc.org/github.com/spf13/afero) [![Join the chat at https://gitter.im/spf13/afero](https://badges.gitter.im/Dev%20Chat.svg)](https://gitter.im/spf13/afero?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/gofunky/afero.svg)](https://travis-ci.org/gofunky/afero)
[![Build status](https://ci.appveyor.com/api/projects/status/github/gofunky/afero?branch=master&svg=true)](https://ci.appveyor.com/project/gofunky/afero) [![GoDoc](https://godoc.org/github.com/gofunky/afero?status.svg)](https://godoc.org/github.com/gofunky/afero)
[![Go Report Card](https://goreportcard.com/badge/github.com/gofunky/afero)](https://goreportcard.com/report/github.com/gofunky/afero)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/e64fc666a8bc43c2b5fd5f5fa771156a)](https://www.codacy.com/app/gofunky/afero?utm_source=github.com&utm_medium=referral&utm_content=gofunky/afero&utm_campaign=Badge_Grade)

# Overview

Expand Down Expand Up @@ -46,15 +49,15 @@ A few different ways you could use Afero:
* Define different filesystems for different parts of your application.
* Use Afero for mock filesystems while testing

## Step 1: Install Afero
## Step 1: Get Afero

First use go get to install the latest version of the library.

$ go get github.com/spf13/afero
$ go get github.com/gofunky/afero

Next include Afero in your application.
```go
import "github.com/spf13/afero"
import "github.com/gofunky/afero"
```

## Step 2: Declare a backend
Expand Down Expand Up @@ -151,7 +154,7 @@ Walk(root string, walkFn filepath.WalkFunc) error
WriteFile(filename string, data []byte, perm os.FileMode) error
WriteReader(path string, r io.Reader) (err error)
```
For a complete list see [Afero's GoDoc](https://godoc.org/github.com/spf13/afero)
For a complete list see [Afero's GoDoc](https://godoc.org/github.com/gofunky/afero)

They are available under two different approaches to use. You can either call
them directly where the first parameter of each function will be the file
Expand Down Expand Up @@ -404,39 +407,6 @@ object of a particular type".
It's also nice that unlike some of my other libraries (hugo, cobra, viper) it
Googles very well.

## Release Notes

* **0.10.0** 2015.12.10
* Full compatibility with Windows
* Introduction of afero utilities
* Test suite rewritten to work cross platform
* Normalize paths for MemMapFs
* Adding Sync to the file interface
* **Breaking Change** Walk and ReadDir have changed parameter order
* Moving types used by MemMapFs to a subpackage
* General bugfixes and improvements
* **0.9.0** 2015.11.05
* New Walk function similar to filepath.Walk
* MemMapFs.OpenFile handles O_CREATE, O_APPEND, O_TRUNC
* MemMapFs.Remove now really deletes the file
* InMemoryFile.Readdir and Readdirnames work correctly
* InMemoryFile functions lock it for concurrent access
* Test suite improvements
* **0.8.0** 2014.10.28
* First public version
* Interfaces feel ready for people to build using
* Interfaces satisfy all known uses
* MemMapFs passes the majority of the OS test suite
* OsFs passes the majority of the OS test suite

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

## Contributors

Names in no particular order:
Expand All @@ -449,4 +419,4 @@ Names in no particular order:
## License

Afero is released under the Apache 2.0 license. See
[LICENSE.txt](https://github.com/spf13/afero/blob/master/LICENSE.txt)
[LICENSE.txt](https://github.com/gofunky/afero/blob/master/LICENSE.txt)
2 changes: 1 addition & 1 deletion afero_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ func TestReaddir(t *testing.T) {
}
}

// https://github.com/spf13/afero/issues/169
// https://github.com/gofunky/afero/issues/169
func TestReaddirRegularFile(t *testing.T) {
defer removeAllTestFiles(t)
for _, fs := range Fss {
Expand Down
15 changes: 0 additions & 15 deletions appveyor.yml

This file was deleted.

7 changes: 4 additions & 3 deletions memmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import (
"sync"
"time"

"github.com/spf13/afero/mem"
"github.com/gofunky/afero/mem"
"io"
)

type MemMapFs struct {
Expand Down Expand Up @@ -228,7 +229,7 @@ func (m *MemMapFs) OpenFile(name string, flag int, perm os.FileMode) (File, erro
file = mem.NewReadOnlyFileHandle(file.(*mem.File).Data())
}
if flag&os.O_APPEND > 0 {
_, err = file.Seek(0, os.SEEK_END)
_, err = file.Seek(0, io.SeekEnd)
if err != nil {
file.Close()
return nil, err
Expand Down Expand Up @@ -274,7 +275,7 @@ func (m *MemMapFs) RemoveAll(path string) error {
m.mu.RLock()
defer m.mu.RUnlock()

for p, _ := range m.getData() {
for p := range m.getData() {
if strings.HasPrefix(p, path) {
m.mu.RUnlock()
m.mu.Lock()
Expand Down
2 changes: 1 addition & 1 deletion sftpfs/sftp.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"os"
"time"

"github.com/gofunky/afero"
"github.com/pkg/sftp"
"github.com/spf13/afero"
)

// Fs is a afero.Fs implementation that uses functions provided by the sftp package.
Expand Down
10 changes: 5 additions & 5 deletions zipfs/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"path/filepath"
"syscall"

"github.com/spf13/afero"
"github.com/gofunky/afero"
)

type File struct {
Expand Down Expand Up @@ -84,10 +84,10 @@ func (f *File) Seek(offset int64, whence int) (int64, error) {
return 0, afero.ErrFileClosed
}
switch whence {
case os.SEEK_SET:
case os.SEEK_CUR:
case io.SeekStart:
case io.SeekCurrent:
offset += f.offset
case os.SEEK_END:
case io.SeekEnd:
offset += int64(f.zipfile.UncompressedSize64)
default:
return 0, syscall.EINVAL
Expand Down Expand Up @@ -139,7 +139,7 @@ func (f *File) Readdirnames(count int) (names []string, err error) {
if err != nil {
return nil, err
}
for filename, _ := range zipfiles {
for filename := range zipfiles {
names = append(names, filename)
if count >= 0 && len(names) >= count {
break
Expand Down
2 changes: 1 addition & 1 deletion zipfs/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"syscall"
"time"

"github.com/spf13/afero"
"github.com/gofunky/afero"
)

type Fs struct {
Expand Down
2 changes: 1 addition & 1 deletion zipfs/zipfs_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package zipfs

import (
"github.com/spf13/afero"
"github.com/gofunky/afero"

"archive/zip"
"path/filepath"
Expand Down

0 comments on commit a91d253

Please sign in to comment.