Skip to content

Commit

Permalink
Update to go1.17
Browse files Browse the repository at this point in the history
Update deprecated code.
Update github actions.
Update dependencies.
  • Loading branch information
Marc-Antoine Ruel committed Oct 27, 2022
1 parent 8d2b28e commit ef3cae0
Show file tree
Hide file tree
Showing 32 changed files with 98 additions and 95 deletions.
31 changes: 17 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# Do not forget to bump every 6 months!
gover: ["1.18"]
gover: ["1.19"]
env:
PYTHONDONTWRITEBYTECODE: x
steps:
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
# Windows.
os: [ubuntu-latest, macos-latest, windows-latest]
# Do not forget to bump every 6 months!
gover: ["1.18"]
gover: ["1.19"]
env:
PYTHONDONTWRITEBYTECODE: x
steps:
Expand Down Expand Up @@ -161,8 +161,8 @@ jobs:
- name: 'Check: no executable was committed (ubuntu)'
if: always() && matrix.os == 'ubuntu-latest'
run: |
if find . -path '*.sh' -prune -o -path ./.git -prune -o -type f -executable -print | grep -e . ; then
echo 'Do not commit executables beside shell scripts'
if find . -path ./.git -prune -o -type f -executable -print | grep -e . ; then
echo 'Do not commit executables'
false
fi
- name: 'Check: addlicense; all sources have a license header (ubuntu)'
Expand All @@ -179,10 +179,10 @@ jobs:
echo "- ${FILE}" >> _gofmt.txt
done
cat _gofmt.txt
echo "## ⚠ gofmt Failed" >> _comments.txt
echo "" >> _comments.txt
cat _gofmt.txt >> _comments.txt
echo "" >> _comments.txt
echo "## ⚠ gofmt Failed" >> ../_comments.txt
echo "" >> ../_comments.txt
cat _gofmt.txt >> ../_comments.txt
echo "" >> ../_comments.txt
false
fi
- name: "Check: misspelling; code doesn't contain misspelling (ubuntu)"
Expand All @@ -191,10 +191,10 @@ jobs:
ERR=$(misspell .)
if ! test -z "$ERR"; then
echo "$ERR"
echo "## ⚠ misspell Failed" >> _comments.txt
echo "" >> _comments.txt
echo "$ERR" >> _comments.txt
echo "" >> _comments.txt
echo "## ⚠ misspell Failed" >> ../_comments.txt
echo "" >> ../_comments.txt
echo "$ERR" >> ../_comments.txt
echo "" >> ../_comments.txt
false
fi
- name: 'Send comments'
Expand Down Expand Up @@ -269,7 +269,10 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
gover: ['1.13.15']
# https://github.com/golang/go/issues/55078
# golang.org/x/sys/unix broke on Go versions before 1.17. Not worth
# fixing.
gover: ['1.17.13']
env:
PYTHONDONTWRITEBYTECODE: x
steps:
Expand All @@ -293,7 +296,7 @@ jobs:
matrix:
os: [ubuntu-latest]
# Do not forget to bump every 6 months!
gover: ["1.18"]
gover: ["1.19"]
permissions:
security-events: write
steps:
Expand Down
14 changes: 7 additions & 7 deletions allwinner/a64.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ func init() {
// The mapping comes from the datasheet page 23:
// http://files.pine64.org/doc/datasheet/pine64/A64_Datasheet_V1.1.pdf
//
// - The datasheet uses TWI instead of I2C but it is renamed here for
// consistency.
// - AIF is an audio interface, i.e. to connect to S/PDIF.
// - RGMII means Reduced gigabit media-independent interface.
// - SDC means SDCard?
// - NAND connects to a NAND flash controller.
// - CSI and CCI are for video capture.
// - The datasheet uses TWI instead of I2C but it is renamed here for
// consistency.
// - AIF is an audio interface, i.e. to connect to S/PDIF.
// - RGMII means Reduced gigabit media-independent interface.
// - SDC means SDCard?
// - NAND connects to a NAND flash controller.
// - CSI and CCI are for video capture.
var mappingA64 = map[string][5]pin.Func{
"PB0": {"UART2_TX", "", "JTAG0_TMS", "", "PB_EINT0"},
"PB1": {"UART2_RX", "", "JTAG0_TCK", "SIM_PWREN", "PB_EINT1"},
Expand Down
2 changes: 1 addition & 1 deletion allwinner/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// If you are looking at the actual implementation, open doc.go for further
// implementation details.
//
// Datasheets
// # Datasheets
//
// A64: http://files.pine64.org/doc/datasheet/pine64/Allwinner_A64_User_Manual_V1.0.pdf
//
Expand Down
12 changes: 6 additions & 6 deletions allwinner/h5.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ import (
// The mapping comes from the datasheet page 55:
// https://linux-sunxi.org/images/a/a3/Allwinner_H5_Manual_v1.0.pdf
//
// - The datasheet uses TWI instead of I2C but it is renamed here for
// consistency.
// - RGMII means Reduced gigabit media-independent interface.
// - SDC means SDCard?
// - NAND connects to a NAND flash controller.
// - CSI and CCI are for video capture.
// - The datasheet uses TWI instead of I2C but it is renamed here for
// consistency.
// - RGMII means Reduced gigabit media-independent interface.
// - SDC means SDCard?
// - NAND connects to a NAND flash controller.
// - CSI and CCI are for video capture.
var mappingH5 = map[string][5]pin.Func{
"PA0": {"UART2_TX", "JTAG_MS", "", "", "PA_EINT0"},
"PA1": {"UART2_RX", "JTAG_CK", "", "", "PA_EINT1"},
Expand Down
4 changes: 2 additions & 2 deletions am335x/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
// GPIOx_y. To get the absolute number, as exposed by sysfs, use 32*x+y to get
// the absolute number.
//
// Datasheet
// # Datasheet
//
// Technical Reference Manual
// https://www.ti.com/lit/ug/spruh73p/spruh73p.pdf
//
// Other
// # Other
//
// Marketing page
// https://www.ti.com/processors/sitara/arm-cortex-a8/am335x/overview.html
Expand Down
4 changes: 2 additions & 2 deletions bcm283x/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
// If you are looking for the actual implementation, open doc.go for further
// implementation details.
//
// GPIOs
// # GPIOs
//
// Aliases for GPCLK0, GPCLK1, GPCLK2 are created for corresponding CLKn pins.
// Same for PWM0_OUT and PWM1_OUT, which point respectively to PWM0 and PWM1.
//
// Datasheet
// # Datasheet
//
// https://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf
//
Expand Down
2 changes: 1 addition & 1 deletion bcm283x/gpio.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ func (p *Pin) FastOut(l gpio.Level) {
//
// It outputs a periodic signal on supported pins without CPU usage.
//
// PWM pins
// # PWM pins
//
// PWM0 is exposed on pins 12, 18 and 40. However, PWM0 is used for generating
// clock for DMA and unavailable for PWM.
Expand Down
4 changes: 2 additions & 2 deletions beagle/black/black.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
// Package black implements headers for the BeagleBone Black and BeagleBone
// Black Wireless micro-computers.
//
// Reference
// # Reference
//
// https://beagleboard.org/black
//
// Datasheet
// # Datasheet
//
// https://elinux.org/Beagleboard:BeagleBoneBlack
//
Expand Down
2 changes: 1 addition & 1 deletion beagle/bone/bone.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// In particular, the headers are found on the models using a TI AM335x
// processor: BeagleBone Black, Black Wireless, Green and Green Wireless.
//
// Reference
// # Reference
//
// http://beagleboard.org/Support/bone101/#hardware
package bone
Expand Down
4 changes: 2 additions & 2 deletions beagle/green/green.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
// Package green implements headers for the BeagleBone Green and BeagleBone
// Green Wireless micro-computers.
//
// Reference
// # Reference
//
// https://beagleboard.org/green
//
// https://beagleboard.org/green-wireless
//
// Datasheet
// # Datasheet
//
// http://wiki.seeedstudio.com/BeagleBone_Green/
package green
Expand Down
19 changes: 10 additions & 9 deletions chip/chip.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package chip
import (
"errors"
"fmt"
"io/ioutil"
"io"
"os"
"path/filepath"
"strconv"
Expand Down Expand Up @@ -126,13 +126,14 @@ var (
//
// It looks for "C.H.I.P" in the device tree. The following information is
// expected in the device dtree:
// root@chip2:/proc/device-tree# od -c compatible
// 0000000 n e x t t h i n g , c h i p \0 a
// 0000020 l l w i n n e r , s u n 5 i - r
// 0000040 8 \0
// root@chip2:/proc/device-tree# od -c model
// 0000000 N e x t T h i n g C . H . I .
// 0000020 P . \0
//
// root@chip2:/proc/device-tree# od -c compatible
// 0000000 n e x t t h i n g , c h i p \0 a
// 0000020 l l w i n n e r , s u n 5 i - r
// 0000040 8 \0
// root@chip2:/proc/device-tree# od -c model
// 0000000 N e x t T h i n g C . H . I .
// 0000020 P . \0
func Present() bool {
return strings.Contains(distro.DTModel(), "C.H.I.P")
}
Expand Down Expand Up @@ -223,7 +224,7 @@ func findXIOBase() int {
if err != nil {
continue
}
b, err := ioutil.ReadAll(f)
b, err := io.ReadAll(f)
if err1 := f.Close(); err == nil {
err = err1
}
Expand Down
2 changes: 1 addition & 1 deletion chip/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// also supported on the XIO pins, but this feature is rather limited due to
// the device and the driver (for example, the driver interrupts on all edges).
//
// References
// # References
//
// http://www.chip-community.org/index.php/Hardware_Information
//
Expand Down
3 changes: 1 addition & 2 deletions cpu/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package cpu

import (
"io"
"io/ioutil"
"os"
"strconv"
"strings"
Expand Down Expand Up @@ -61,7 +60,7 @@ func getMaxSpeedLinux() int64 {
maxSpeed = 0
if f, err := openFile("/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq", os.O_RDONLY); err == nil {
defer f.Close()
if b, err := ioutil.ReadAll(f); err == nil {
if b, err := io.ReadAll(f); err == nil {
s := strings.TrimSpace(string(b))
if i, err := strconv.ParseInt(s, 10, 64); err == nil {
// Weirdly, the speed is listed as khz. :(
Expand Down
3 changes: 1 addition & 2 deletions cpu/cpu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package cpu
import (
"bytes"
"io"
"io/ioutil"
"os"
"testing"
"time"
Expand All @@ -31,7 +30,7 @@ func TestMaxSpeed(t *testing.T) {
if flag != os.O_RDONLY {
t.Fatal(flag)
}
return ioutil.NopCloser(bytes.NewBufferString("1001\n")), nil
return io.NopCloser(bytes.NewBufferString("1001\n")), nil
}
MaxSpeed()
if s := getMaxSpeedLinux(); s != 1001000 {
Expand Down
4 changes: 2 additions & 2 deletions distro/devtree.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package distro

import (
"encoding/binary"
"io/ioutil"
"os"
)

// DTModel returns platform model info from the Linux device tree (/proc/device-tree/model), and
Expand Down Expand Up @@ -50,7 +50,7 @@ func DTRevision() uint32 {
return dtRevision
}
dtRevisionRead = true
if b, _ := ioutil.ReadFile("/proc/device-tree/system/linux,revision"); len(b) >= 4 {
if b, _ := os.ReadFile("/proc/device-tree/system/linux,revision"); len(b) >= 4 {
dtRevision = binary.BigEndian.Uint32(b[:4])
}
return dtRevision
Expand Down
3 changes: 1 addition & 2 deletions distro/distro.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
package distro

import (
"io/ioutil"
"os"
"strconv"
"strings"
Expand Down Expand Up @@ -98,7 +97,7 @@ var (
mu sync.Mutex
cpuInfo map[string]string
osRelease map[string]string
readFile = ioutil.ReadFile
readFile = os.ReadFile
)

func splitSemiColon(content string) map[string]string {
Expand Down
4 changes: 2 additions & 2 deletions ftdi/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func newFT232H(g generic) (*FT232H, error) {
// Pins C8 and C9 can only be used in 'slow' mode via EEPROM and are currently
// not implemented.
//
// Datasheet
// # Datasheet
//
// http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT232H.pdf
type FT232H struct {
Expand Down Expand Up @@ -517,7 +517,7 @@ func newFT232R(g generic) (*FT232R, error) {
// Pin C4 can only be used in 'slow' mode via EEPROM and is currently not
// implemented.
//
// Datasheet
// # Datasheet
//
// http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT232R.pdf
type FT232R struct {
Expand Down
4 changes: 2 additions & 2 deletions ftdi/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
//
// Use build tag periph_host_ftdi_debug to enable verbose debugging.
//
// More details
// # More details
//
// See https://periph.io/device/ftdi/ for more details, and how to configure
// the host to be able to use this driver.
//
// Datasheets
// # Datasheets
//
// http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT232R.pdf
//
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

module periph.io/x/host/v3

go 1.13
go 1.17

require (
periph.io/x/conn/v3 v3.6.10
periph.io/x/d2xx v0.0.4
periph.io/x/conn/v3 v3.7.0
periph.io/x/d2xx v0.1.0
)
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ=
github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=
periph.io/x/conn/v3 v3.6.10 h1:gwU4ssmZkq1D/uz8hU91i/COo2c9DrRaS4PJZBbCd+c=
periph.io/x/conn/v3 v3.6.10/go.mod h1:UqWNaPMosWmNCwtufoTSTTYhB2wXWsMRAJyo1PlxO4Q=
periph.io/x/d2xx v0.0.4 h1:R1Yejby5Ny6cVRo94RlMgXFtpp6AJrsVNAAjQCQx5rA=
periph.io/x/d2xx v0.0.4/go.mod h1:38Euaaj+s6l0faIRHh32a+PrjXvxFTFkPBEQI0TKg34=
github.com/jonboulle/clockwork v0.3.0 h1:9BSCMi8C+0qdApAp4auwX0RkLGUjs956h0EkuQymUhg=
github.com/jonboulle/clockwork v0.3.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=
periph.io/x/conn/v3 v3.7.0 h1:f1EXLn4pkf7AEWwkol2gilCNZ0ElY+bxS4WE2PQXfrA=
periph.io/x/conn/v3 v3.7.0/go.mod h1:ypY7UVxgDbP9PJGwFSVelRRagxyXYfttVh7hJZUHEhg=
periph.io/x/d2xx v0.1.0 h1:aR+hMkz57YbQHR+Rji4jHH43YLTITRZUr2HjhqCYa7k=
periph.io/x/d2xx v0.1.0/go.mod h1:OflHQcWZ4LDP/2opGYbdXSP/yvWSnHVFO90KRoyobWY=
2 changes: 1 addition & 1 deletion odroidc1/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// header pins 19/21/23/24. The onewire gpio driver appears to be loaded by
// default on header pin 7.
//
// References
// # References
//
// Product page: http://www.hardkernel.com/main/products/prdt_info.php?g_code=G143703355573&tab_idx=2
//
Expand Down
Loading

0 comments on commit ef3cae0

Please sign in to comment.