Montage_GetCurrentSection
对此表彰import { connect } from 'react-redux';
import {withRouter} from 'react-router';
import { Link } from 'react-router-dom';
import PropTypes from 'prop-types';
import {Line} from 'react-chartjs-2';
class ChartPage extends Component {
profitForChart = (props) => {
let total = 0
return this.props.playedGames.slice().reverse().map( (game, index) => ({
x: index,
y: total += parseFloat(game.profit)
}))
}
render() {
if(!this.props.playedGames) return <h1>Loading...</h1>
const { classes } = this.props;
const data = {
datasets: [{
data: this.profitForChart(),
label: 'PROFIT'
}],
labels: this.props.playedGames.slice().reverse().map( game => (new Date(game.start_date_time)).toLocaleDateString()),
}
return(
<div className={classes.root}
<Line data={data} />
</div>
)
}
}
const mapStateToProps = ( state ) => {
return {
playedGames: state.userPlayedGames.playedGames,
isLoading: state.isLoading,
}
}
const mapDispatchToProps = {
}
ChartPage.propTypes = {
classes: PropTypes.object.isRequired,
};
export default compose(
withStyles(styles, {
name: 'ChartPage',
}),
connect(mapStateToProps, mapDispatchToProps))(withRouter(ChartPage));
感到困惑
并在执行此操作时出错...
all: gotool
@go build -v .
clean:
rm -f apiserver
find . -name "[._]*.s[a-w][a-z]" | xargs -i rm -f {}
gotool:
gofmt -w .
go tool vet . |& grep -v vendor;true
help:
@echo "make - compile the source code"
@echo "make clean - remove binary file and vim swp files"
@echo "make gotool - run go tool 'fmt' and 'vet'"
@echo "make ca - generate ca files"
.PHONY: clean gotool help
答案 0 :(得分:1)
该命令尝试将标准输出和标准错误都重定向到grep
。便携式(主观上更好)的方法是
go tool vet . 2>&1 | grep -v vendor || true
即使true
找不到任何匹配项(例如,没有不包含make
的输出行),结尾的grep
也会导致vendor
命令成功。回想一下make
在默认情况下会在第一个错误时中断编译;这样可以避免出现明显仅用于监视或娱乐的命令。