Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create aix.go #314

Closed
wants to merge 2 commits into from
Closed

Create aix.go #314

wants to merge 2 commits into from

Conversation

dsgrangs-paul
Copy link

Empty implementation, just to allow build

What does this pull request do?

It proposes an empty implementation, so that this can bu built on AIX

Where should the reviewer start?

Only one file to review, rather simple as all methods return either nil, or errors.New("not implemented")

How should this be manually tested?

This new file allows you to build the package on AIX.
This fsnotify package is used as a dependency but the runtime is not necessary.

Empty implementation, just to allow build
)

var (
ErrWatchedFileDeleted = errors.New("error: watched file or folder deleted")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported var ErrWatchedFileDeleted should have comment or be unexported

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this here?

To take into account travis complaint
@amdprophet
Copy link

We're looking forward to using this change in https://github.com/sensu/sensu-go! Is there a timeline available for merging it?

@dsgrangs-paul
Copy link
Author

We're looking forward to using this change in https://github.com/sensu/sensu-go! Is there a timeline available for merging it?

I wish it can be merged asap, but we need a review to be done

@amdprophet
Copy link

@nathany any chance you can take a look at this soon?

@amdprophet
Copy link

@tklauser do you have the power to get this merged?

@tklauser
Copy link
Contributor

tklauser commented Jun 4, 2020

Unfortunately I don‘t. Maybe @cpuguy83 can help getting this merged?

@cpuguy83
Copy link
Contributor

cpuguy83 commented Jun 4, 2020

I don't understand why do we need the empty implementation?

@echlebek
Copy link

echlebek commented Jun 4, 2020

The empty implementation is needed so that programs that depend on fsnotify can be built on AIX. The fsnotify support won't work, but in a lot of cases that's better than the program failing to build at all.

I think the empty implementation could probably be simplified. It looks like there's some unnecessary code that's not really doing anything.

@cpuguy83
Copy link
Contributor

cpuguy83 commented Jun 4, 2020

If fsnotify doesn't compile on a platform, why is it imported there?

@echlebek
Copy link

echlebek commented Jun 4, 2020

fsnotify in many cases is a dependency of a dependency of a dependency. If it doesn't build on AIX, then every package that imports it has to create build workarounds for AIX, should they wish to support AIX.

You might argue that it's not fsnotify's responsibility to provide this convenience. I agree, but if compatibility can be offered here, it would save rather a lot of work for rather a lot of people! :)

@cpuguy83
Copy link
Contributor

cpuguy83 commented Jun 5, 2020

I'd be fine if a fsnotify_unsupported.go file was added if all that is needed is to keep the compiler from complaining that there's no compatible go source files, but otherwise it seems a bit off to add a dummy implementation.

@Helflym
Copy link

Helflym commented Jun 11, 2020

Hi guys, I've submitted sometimes ago a PR which enables fsnotify on AIX (#326). It would be better to have this version even if not perfect than to disable fsnotify completely.
Note that I still support that a fsnotify_unsupported.go should be added. This is helping a lot new GOOS coming into Go environment.

@nathany nathany mentioned this pull request Jan 19, 2022
Copy link
Contributor

@nathany nathany left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of fsnotify_unsupported.go for multiple unsupported OSes, including AIX.

It might be a good idea to have some tests for this to ensure that the usage behaves appropriately when interacting with a stubbed out implementation?

// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build aix
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should add the new style build tags too

)

var (
ErrWatchedFileDeleted = errors.New("error: watched file or folder deleted")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this here?

Comment on lines +45 to +59
var wg sync.WaitGroup
wg.Add(1)

w := &Watcher{
Events: make(chan Event),
Errors: make(chan error),
closed: make(chan struct{}),
close: make(chan struct{}),
mu: new(sync.Mutex),
wg: &wg,
files: make(map[string]os.FileInfo),
names: make(map[string]bool),
}
go w.readEvents()
return w, nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know that an empty implementation should do this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just return errors.New("Not implemented")?

tklauser added a commit to tklauser/fsnotify that referenced this pull request Jan 24, 2022
In cases where fsnotify is a transitive dependency of a package, it
might need to be built on platforms not supported (yet), e.g. aix.
Provide an empty implemention for these cases, so depending packages
don't need to add workarounds.

Replaces fsnotify#314
tklauser added a commit to tklauser/fsnotify that referenced this pull request Jan 24, 2022
In cases where fsnotify is a transitive dependency of a package, it
might need to be built on platforms not supported (yet), e.g. aix.
Provide an empty implemention for these cases, so depending packages
don't need to add workarounds.

Replaces fsnotify#314
@tklauser
Copy link
Contributor

FWIW, I've opened #424 adding a minimal fsnotify_unsupported.go as suggested.

@nathany nathany closed this Jan 25, 2022
nathany pushed a commit that referenced this pull request Jan 25, 2022
In cases where fsnotify is a transitive dependency of a package, it
might need to be built on platforms not supported (yet), e.g. aix.
Provide an empty implemention for these cases, so depending packages
don't need to add workarounds.

Replaces #314
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants