Merge pull request #17431 from oscr/use-seekstart
Use io.SeekStart instead of deprecated os.SEEK_SET
This commit is contained in:
commit
9bf9280c03
|
@ -83,7 +83,7 @@ func (s *LocalState) WriteState(state *terraform.State) error {
|
||||||
s.state.Serial = s.readState.Serial
|
s.state.Serial = s.readState.Serial
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := s.stateFileOut.Seek(0, os.SEEK_SET); err != nil {
|
if _, err := s.stateFileOut.Seek(0, io.SeekStart); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := s.stateFileOut.Truncate(0); err != nil {
|
if err := s.stateFileOut.Truncate(0); err != nil {
|
||||||
|
@ -156,7 +156,7 @@ func (s *LocalState) RefreshState() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// we have a state file, make sure we're at the start
|
// we have a state file, make sure we're at the start
|
||||||
s.stateFileOut.Seek(0, os.SEEK_SET)
|
s.stateFileOut.Seek(0, io.SeekStart)
|
||||||
reader = s.stateFileOut
|
reader = s.stateFileOut
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
package state
|
package state
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"io"
|
||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import (
|
||||||
func (s *LocalState) lock() error {
|
func (s *LocalState) lock() error {
|
||||||
flock := &syscall.Flock_t{
|
flock := &syscall.Flock_t{
|
||||||
Type: syscall.F_RDLCK | syscall.F_WRLCK,
|
Type: syscall.F_RDLCK | syscall.F_WRLCK,
|
||||||
Whence: int16(os.SEEK_SET),
|
Whence: int16(io.SeekStart),
|
||||||
Start: 0,
|
Start: 0,
|
||||||
Len: 0,
|
Len: 0,
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ func (s *LocalState) lock() error {
|
||||||
func (s *LocalState) unlock() error {
|
func (s *LocalState) unlock() error {
|
||||||
flock := &syscall.Flock_t{
|
flock := &syscall.Flock_t{
|
||||||
Type: syscall.F_UNLCK,
|
Type: syscall.F_UNLCK,
|
||||||
Whence: int16(os.SEEK_SET),
|
Whence: int16(io.SeekStart),
|
||||||
Start: 0,
|
Start: 0,
|
||||||
Len: 0,
|
Len: 0,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue